title: Json foreach loop is outputting the word object instead of its contents
body: <p>I am attempting to send the <code>foreach</code> loop through json and then display with <code>innerHTML</code>. There aren't any errors. The issue I am having is that the output is display:</p>
  
  <blockquote>
    <p>[object Object]</p>
  </blockquote>
  
  <p>Instead of what is in the foreach loop.</p>
  
  <p>How do I get the output to be the <code>$html</code> lines that are within the <code>foreach</code> loop?</p>
  
  <pre><code>try {
      $sql_recentProjects = "
          SELECT *
          FROM project_gallery
          ORDER BY date_added ASC
          LIMIT 5
      ";
      if ($recentProjects_stmt = $con-&gt;prepare($sql_recentProjects)) {
          $recentProjects_stmt-&gt;execute();
          $recentProjects_rows = $recentProjects_stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
          $recProj_arr = array();
          foreach ($recentProjects_rows as $recentProjects_row) {
              $precProjName = $recentProjects_row['p_name'];
              $recProjImg = $recentProjects_row['p_img'];
              //$project_img = substr($project_img, 2);
              $displayRecProjImg = '&lt;img src="/php'.$recProjImg.'" alt="'. $precProjAlt .'" class="projectDisplayImg"&gt;';
              $html = '';
              $html .= '&lt;div class="recentProjectCont"&gt;';
              $html .= '&lt;div class="recentProjectImg"&gt;';
              $html .= $displayRecProjImg;
              $html .= '&lt;/div&gt;';
              $html .= '&lt;div class="recProjInfoCont"&gt;';
              $html .= '&lt;div class=""&gt;';
              $html .= $precProjName;
              $html .= '&lt;/div&gt;';
              $html .= '&lt;/div&gt;';
              $html .= '&lt;/div&gt;';
              $recentProjData = array('html' =&gt; $html);
              //$proj_arr[] = $data;
          }
      }
  }
  catch(PDOException $e) {
      echo "Connection failed: " . $e-&gt;getMessage();
  }
  echo json_encode(['recentProjectData' =&gt; $recentProjData]);
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>function ajaxCallCatalogs() {
      $.ajax({
          url: 'php/projects/projectGallerySelect.php',
          datatype: 'json',
          success: function (data) {
              //console.log(data);
              obj = JSON.parse(data);
              recentProjectData = obj.recentProjectData; //Recent 5 Projects submitted to gallery
  
              document.getElementById('recentProjectWrap').innerHTML = recentProjectData;
          }
      });
  }
  ajaxCallCatalogs();
  setInterval(ajaxCallCatalogs, 150000);
  </code></pre>