title: Creating table's and div's in javascript
body: <p>I've got a javascript document where I'm getting a json object and I want to create div's because I can have more than an instance on the json array. I'm creating an article , changing his innerHTML and adding it to the body but it doesn't get added.</p>
  
  <pre><code>$.ajax({
      url: 'myURL',
      type: "GET",
      data: query,
      dataType: 'json',
      success: function (data) {
        alert(data);
        for (var i = 0; i &lt; data.length; i++) 
        { 
          var _body = document.getElementsByTagName('body') [0];
          alert(_body.innerHTML);
          var article = document.createElement('article');
          article.id = 'invoiceno'+i;
          article.innerHTML = '&lt;div id="client"&gt;&lt;/div&gt;&lt;table class="cabecalho"&gt;&lt;tr&gt;&lt;th&gt;&lt;span&gt;Invoice #&lt;/span&gt;&lt;/th&gt;&lt;td id="invoiceno"&gt;&lt;span&gt;invoiceno&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;&lt;span&gt;Date&lt;/span&gt;&lt;/th&gt;&lt;td id="invoicedate"&gt;&lt;span&gt;invoicedate&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;table class="total"&gt;&lt;tr&gt;&lt;th&gt;&lt;span &gt;Total&lt;/span&gt;&lt;/th&gt;&lt;td&gt;&lt;span data-prefix&gt;€&lt;/span&gt;&lt;span id="tots"&gt;(TotalAPagar)&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;';
          alert(article.innerHTML);
          _body.appendChild(article);
          $("#invoiceno"+i).html(data[i].InvoiceNo);
          $("#invoicedate"+i).html(data[i].InvoiceDate);
          $("#client"+i).html(data[i].CompanyName);
          $("#tots"+i).html(data[i].GrossTotal);
        } 
      }
  });
  </code></pre>