submit multiple forms one by one using jquery
I want to submit multiple forms one by one and I'm working with php and jquery. I have two or multiple forms with values, and when I click add button, first form should display in a popup window with the entered values and a submit button.
When I click submit in the popup window, first form should be submitted and second form should be displayed in the popup window.
How should I do this?
<div id="whole">
<form id="frm1"><table><tr><td>
<label>Title : </label>
<input id="frm1title1" type="text"></td></tr>
<tr><td><label>Descr : </label>
<textarea cols="50" rows="10" id="frm1desc1"></textarea></td></tr></table>
</form>
<hr>
<form id="frm2">
<table><tr><td><label>Ti开发者_Go百科tle : </label>
<input id="frm2title2" type="text"></td></tr>
<tr><td><label>Descr : </label>
<textarea cols="50" rows="10" id="frm2desc2"></textarea></td></tr></table>
</form>
<input type="button" value="add">
</div>
take a look at Jquerys submit api ... bind the submit button to submit all the forms..
something like this
replace your
<input type="button" value="add">
with
<input id="submitbutton" type="button" value="add">
then JS as follows:
$("#submitbutton").click(function(){
$("#frm1").submit();
$("#frm2").submit();
});
精彩评论