title: How to recreate a table dynamically in javascript
body: <p>I am creating a table dynamically in a return statement from ajax. But I see only one row of the table, although debugger shows data.length as 4. How do I correct the recreating of table?</p>
  
  <pre><code>// using ajax return to recreate a table
  // ...
  
  if (data.length &gt; 0) {
      for (var i = 0; i &lt; data.length; i++) {
          var $mytablerow = $(
              '&lt;table&gt;' +
                  '&lt;tbody&gt;' +
                      '&lt;tr&gt;' +
                          '&lt;td id="td' + data[i].Value + '" &gt;' +
                              data[i].Text +
                          '&lt;/td&gt;' +
                      '&lt;/tr&gt;' +
                  '&lt;/tbody&gt;' +
              '&lt;/table&gt;'
          );
      }
  }
  
  var $mylst = $("#Userslist");
  $mylst.html($mytablerow);
  
  // ....
  </code></pre>