I have a table where I can move rows up or down which I have put an id on the . Now I need to save the the new order of the table. I am thinking I need to save the rows[index] and but I have no experience with jquery. My table is id="rtbl", the button to call the function is "sroute". I have an alert in the function but that is not working. Just new to jquery, what do I need to do to make this work?
$("#sroute").click(function(){ alert("Hello") $("#rtbl tr").each(function() { var val1 = $(t.rows[i].cells[0]).text(); alert(val1) ; i++; }); }); <button id="sroute">Save Order</button> <table id='rtbl'> <tr><th>Invoice</th></tr> <tr id='789'><td>789</td></tr> <tr id='123'><td>123</td></tr> <tr id='456'><td>456</td></tr> </table> So the goal is to update the db field 'stopnum' where invoice 789 stopnum would be 1, invoice 123 stopnum would be 2, and invoice 456 stopnum would be 3.