title: How to get the value of a particular row's cell
body: <p>I've been trying to figure this out, and have been having a lot of trouble so I'd appreciate the help. This is the situation. I have a dynamically generated table, and for example, lets say that there are ten rows in this dynamically generated table from data obtained from a database. I'm using this code to get the data from the database using JSON.</p>
  
  <pre><code>$(document).ready(function() {
      $("#findtrucker-btn").click(function(event){
          $.getJSON("/getallLoadsA", function(loads) {
              var tr = loads;
              for (var i = 0; i &lt; loads.length; i++) {
                  tr = $('&lt;tr/&gt;');
                  tr.append("&lt;td&gt;" + i + "&lt;/td&gt;");
                  tr.append("&lt;td&gt;" + loads[i].loadname + "&lt;/td&gt;");
                  tr.append("&lt;td&gt;" + loads[i].category + "&lt;/td&gt;");
                  tr.append("&lt;td&gt;" + loads[i].space + "&lt;/td&gt;");
                  tr.append("&lt;td&gt;" + loads[i].weight + "&lt;/td&gt;");
                  tr.append("&lt;td&gt;" + loads[i].loadprice + "&lt;/td&gt;");
                  tr.append("&lt;td&gt;" + loads[i].street + " " + loads[i].city + ", " + loads[i].state + "&lt;/td&gt;");
                  tr.append("&lt;td&gt;" + loads[i].dstreet + " " + loads[i].dcity + ", " + loads[i].dstate + "&lt;/td&gt;");
                  tr.append("&lt;td&gt;" + loads[i].status + "&lt;/td&gt;");
                  tr.append("&lt;td&gt;&lt;button onclick=update()&gt;Update&lt;/button&gt;&lt;/td&gt;");
                  $('#table').append(tr);
              }
          });
      });
  });
  </code></pre>
  
  <p>So, I have 10 rows in my table, and each row has a button with name "update" that when clicked, I want to go to a different page. I've found that using the following will get me the desired output and page load, but only for row 1.</p>
  
  <pre><code>window.location.href = '/updateload?loadname='+(document.getElementById("table").rows[1].cells.item(1).innerHTML);
  </code></pre>
  
  <p>I want to be able to, from clicking the button "update" on each row, access that particular row's 2nd value so that loadname='that particular row's loadname' or loads[i].loadname where i = the row I'm currently on for that particular button and switch pages appropriately where upon switching pages, I will be able to get data for that row and be able to update data subsequently. Also, data is being appended to this table:</p>
  
  <pre><code>&lt;table id="table" class="table table-bordered table-striped"&gt;
      &lt;tr&gt;
          &lt;th&gt;#&lt;/th&gt;
          &lt;th&gt;Loadname&lt;/th&gt;
          &lt;th&gt;Category&lt;/th&gt;
          &lt;th&gt;Space&lt;/th&gt;
          &lt;th&gt;Weight&lt;/th&gt;
          &lt;th&gt;Load Price&lt;/th&gt;
          &lt;th&gt;Pickup Location&lt;/th&gt;
          &lt;th&gt;Deliver Location&lt;/th&gt;
          &lt;th&gt;Status&lt;/th&gt;
          &lt;th&gt;Update&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>