How to serialize dynamic form inputs?
<table id="mytable">
<form id="myform">
<tbody>
<tr><td><input type="text" name="row0"></td></tr>
<tr><td><input type="text" name="row1"></td></tr>
<tr><td><input type="text" name="row2"></td></tr>
<tr><td><input type="text" name="row3"></td></tr>
</tbody>
<tfoot>
<tr><td><input type="button" id="save" value="SAVE"></td></tr>
</tfoot>
</form>
</table>
I want to use jQuery to load information from php
$('#save').click(function(){
$.ajax({
type: "POST",
url: "post.php",
data: $('#myform').serialize(),
success: function(msg){
console.log(msg);
}
});
});
This will not work if the lines are not dynamically generated, but I cannot figure out how to access or serialize dynamic content.
source
share