I tried submitting form data without reloading the page using a submit event check. Below is my piece of code:
$( "#my-form" ).submit(function( event ) {
alert( "Handler for .submit() called." );
//event.preventDefault();
return false;
});
Due to this page refresh has been stopped. But the action mapping to the form is not getting called. Is there any way that I can call the action and submit data without reloading page.
In the submit handler you have to make an ajax call that serializes the form data and sends it over. Adding event.preventDefault()
and return false
avoid the page refresh
See this Submit form via AJAX in jQuery
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.