php - Two forms submit only one button javascript and open popup window -


this javascript

<script type="text/javascript">     $(document).ready(function () {         $("#submitbutton").click(function () {             var $form1 = $("#form1");             $.post($form1.attr("action"), $form1.serialize(),           $('form[name="formsub"]').each(function () {             var $form = $(this);             $.post($form.attr("action"), $form.serialize(),              })         });     }); </script> <form id="form1" action="exam_fee_update1.php" method="post">     // code     </form>     <form id="form2" action="exam_fee_update1.php" name= "formsub" method="post">         // code </form> 

when submit 2 forms data insert want after submit of 2 forms open popup window , display submit details.. me.

jquery $.post throws callback once request done: after each form submitted display serialized contents:

$(document).ready(function () {      $("#submitbutton").click(function () {         // serialize 2 forms         var formdata = $('#form1, #form2').serialize();         var formaction =  $('#form1').attr("action");         $.post( formaction, formdata, function(reply){            // create popup box within browser , show details            alert(formdata);         });    } ) 

if it's debugging purposes can use chrome dev tools under network tab, you'll have make sure tick preserve log if page reloads.

enter image description here

enter image description here


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -