form submission jquery and get response in consoleDVdip vyas7yAsked Sep 6, 2019, 4:47 AM800AJAXform submit to jquery ajx and get responce in console
Sonu Gupta7y agoPosted Sep 9, 2019, 2:25 AMHi, Visit the below links - https://www.aspsnippets.com/Articles/Call-ASPNet-Page-Method-using-jQuery-AJAX-Example.aspx https://www.c-sharpcorner.com/UploadFile/dacca2/understand-jquery-ajax-function-call-code-behind-C-Sharp-method/
Pritesh Bhoi7y agoPosted Sep 6, 2019, 7:09 AMIf you want to get the response in a callback, you can't post the form. Posting the form means that the response is loaded as a page. You have to get the form data from the fields in the form and make an AJAX request.Example: $(function(){ $('form[name=new_post]').submit(function(){ $.post($(this).attr('action'), $(this).serialize(), function(json) { alert(json); }, 'json'); return false; }); }); Notice that you have to return false from the method that handles the submit event, otherwise the form will be posted also.
Sonu GuptaPosted Sep 9, 2019, 2:25 AM
Pritesh BhoiPosted Sep 6, 2019, 7:09 AM