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
Post a Comment