ajax - JQuery $.post() submitting multiple forms instead of just one -


i have page several forms on 1 page. have button (outside forms) want submit 1 form, form data getting submitted forms.

$("#indiv_save").click( function() {     alert($("#indiv_form").serialize());  // shows correct form     $.post("/admin/update", $("#indiv_form").serialize(), function(data) {         notify(data); // quick , easy feedback     }); }); 

the alert() call shows want submit, firebug shows fields being submitted forms after .post(), though serialize() function identical.

all forms have different names , element ids.

what doing wrong?

you making ajax post , returning. depending on button, it's going attempt submit page's forms. need prevent default action:

 $('#indiv_save').click(function(e)  {       e.preventdefault();       // code here  }); 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -