title: Creating a dynamic table from AJAX reply query
body: <p>I have the following code:</p>
  
  <pre><code>            var htmlname='';
              var names = result.names
              $.each(names, function( i, name){
  
                 htmlname = "&lt;td&gt;" + name + "&lt;/td&gt;";
  
                 $('#adminall tr:last').html(htmlname);
  
                  var row = document.createElement('tr');
                  var tableCurrentPoints = document.getElementById("adminall"); // find table to append to
                  tableCurrentPoints.appendChild(row); // append row to table
  
  
              });
  
  
              var htmlemail='';
              var emails = result.emails
              $.each(emails, function( ii, email){
  
                 htmlemail = "&lt;td&gt;" + email + "&lt;/td&gt;";
  
                 $('#adminall tr:last').html(htmlemail);
  
                  var row = document.createElement('tr');
                  var tableCurrentPoints = document.getElementById("adminall"); // find table to append to
                  tableCurrentPoints.appendChild(row); // append row to table
  
  
              });
  </code></pre>
  
  <p>And then the table which its appending too:</p>
  
  <pre><code>        &lt;table id="adminall" style="margin:10px 0px 0px 0px;" width="100%" border="0" cellpadding="0" cellspacing="0"&gt;
          &lt;tr id="adminallheader"&gt;
  
          &lt;/tr&gt;
          &lt;tr&gt;&lt;/tr&gt;
  
      &lt;/table&gt;
  </code></pre>
  
  <p>This is from a success handler within an AJAX request. I am attempting to create a table populated with the data from the query, and I'm guessing it should be created in Javascript as I am attempting here, but I can't get it to work. At the moment it has all the data (name and email) in one column, but it needs to be split across the two.</p>
  
  <p>Any ideas?</p>