php - jQuery Multiple Forms Submit -
i have 4 forms on page. know forms cannot nested.
<form id="form1"></form>
<form id="form2"></form>
<form id="form3"></form>
<form id="form4"></form>
presented in order.
form 1 , form 4 post same php page processing. form 1 have 1 input field form 4 have multiple fields, checkboxes , selects.
what best approach both form 1 or form 4 sending combined fields of both forms?
i've tried jquery, works great text input , checkbox, can't work select. tried combining form 1 , form 4 , using css repositioning form 1, can't layout right.
is there simpler this?
it's not possible. can either use serialize() or serializearray() method getting forms' data , post them server using ajax:
encode set of form elements string submission.
$('#send').click(function() { var firstformdata = $('form:eq(0)').serializearray(); var fourthformdata = $('form:eq(3)').serializearray(); $.ajax({ url : '...', type : 'post', data : firstformdata.concat(fourthformdata) }).done(function() { // ... }); });
Comments
Post a Comment