title: Insert array values in table cell with javascript
body: <p>I need to insert some values ​​in a table. All values are contained in a returned array from an Ajax/php request like this:</p>
  
  <pre><code>var data = [];
  
  //Consider that the number of the object (in this case only 3) obtained from the server are equal to the number of rows in tbody (6 rows in tbody = 6 object from server).
  
  data[0] = {From: '01/01/2012', To: '01/01/2013', Interest: 80.00, Residual: 0, Capital: 1000.00, Days: 366};
  data[1] = {From: '01/01/2013', To: '01/01/2014', Interest: 85.00, Residual: 0, Capital: 980.00, Days: 365};
  data[2] = {From: '01/01/2014', To: '29/04/2014', Interest: 20.00, Residual: 75.00, Capital: 980.00, Days: 118};
  </code></pre>
  
  <p>It's a bit tricky to explain how the values must to be inserted in the table, so I created a fiddle with the result I would like to get.
  I do not expect you to give me the final result (of course, would be welcome :) ), but at least some idea from which to start.</p>
  
  <p><strong><a href="http://jsfiddle.net/nb3gr/1/" rel="nofollow">FIDDLE</a></strong></p>
  
  <p><strong>**EDIT</strong></p>
  
  <p>I assigned id to cells and now all values are right inserted. That's the updated fiddle, do you think code can be written more elegantly?</p>
  
  <p><strong><a href="http://jsfiddle.net/nb3gr/3/" rel="nofollow">UPDATE FIDDLE</a></strong></p>