javascript - Load post ajax data in div -


i have below code.

    jquery(document).on('submit', '#myform', function (e) {         e.preventdefault();         var formdata = jquery(this).serialize();         jquery.ajax({             url: this.action,             data: formdata,             success: jquery( "#popup" ).load( this.action + '?' + formdata )         });     }); 

what have works think there must better (proper way this)?

i thought load data line above in success data not defined?

based on description of jquery.load:

load data server , place returned html matched element

it looks should able like:

jquery(document).on('submit', '#myform', function (e) {     e.preventdefault();     var formdata = jquery(this).serialize();     jquery('#popup').load(this.action, formdata); }); 

this should take whatever html returned server on this.action , pop element id="popup".


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -