JQuery .each loop prob

Randyo

New Member
Okay so here's the idea: I want to make a jQuery script to handle multiple forms. Every form has a button. When you click this button the script should send all input fields' name and value in $_POST to the form's action url. But I cant make it work.It won't loop through my .each on line 3 in my jQuery file.jQuery:\[code\]$("input[type='button']").click(function(){ var query = {}; $(this).parent('form').children('input[type="text"]').each(function(){ query[$(this).attr('name')] = $(this).val(); }); $.post($(this).parent('form').attr('action'), query, function(data) { $("#dialog").html(data); $("#ui-id-1").html('Activate account'); $("#dialog").dialog("open"); }, 'json');});\[/code\]HTML:\[code\]<form action="/action/activateacc.php"><table> <tr> <td>E-mail:</td> <td><input type="text" id="mail" name="mail" /></td> <td><img class="tick" id="mailIMG" width="20px" /></td> </tr> <tr> <td>Activation code:</td> <td><input type="text" id="code" name="code" /></td> <td><img class="tick" id="codeIMG" width="20px" /></td> </tr> <tr> <td>Choose organization-name:</td> <td><input type="text" id="name" name="name" /></td> <td><img class="tick" id="nameIMG" width="20px" /></td> </tr> <tr> <td></td> <td style="text-align:center"><input type="button" style="cursor:pointer" value="http://stackoverflow.com/questions/14461828/Activate account" /></td> </tr> </table> </form>\[/code\]
 
Back
Top