serialization - Input in tr>td>input is not processed with jquery serialize -
i have found solution problem face under last solution provided under link: create html table each tr form
anyhow, here fragments code: html:
<tr class="a1td"> <td class="style1">12</td> <td class="style1">i_pinz/td> <td class="style1">2013-05-12</td> <td class="style1">2013-05-12</td> <td class="style1"><input type="text" name="name1" value="val1" id="name1" size="50" maxlength="50" placeholder="exampletext" /></td> <td class="style1"><input type="text" name="name2" value="val2" id="name2" size="20" maxlength="32" placeholder="example2" class="cleaninput" /></td> <td class="style1"><input type="text" name="name3" value="" id="name3" size="20" maxlength="32" placeholder="example" /></td> <td class="style1"><input type="text" name="name4" value="val4" id="link" size="50" maxlength="255" placeholder="example" /></td> <td class="style1"><input type="text" name="name4" value="0" size="4" /></td> ... links , images <td><button name="apply" type="submit" class="submitrow" ><img src="accept.png" alt=""/></button> <input type="hidden" name="id" value="xx" /> </td> <tr>
the javascript:
<script type="text/javascript"> $(document).ready(function(){ $(".submitrow").click(function() { console.log('inside submit function'); var form = '<form><table><tr>' + $(this).closest('tr').html() + '</tr></table></form>'; var serialized = $(form).serialize(); console.log(serialized); $.post("quickedit", serialized); }); }); </script>
so, issue now: if update field name3 , press button, function called supposed , wanted, anyhow if console-log field name3 not presenting updated value. hence code @ server-side not working.
i use latest jquery 1.9.x , table not enclosed inside <form></form>
.
any suggestions welcome.
try -
var serialized = $(form).find('form').serialize();
or
var serialized = $(this).closest('tr').serialize();
Comments
Post a Comment