-1

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.

devlin carnate
  • 8,309
  • 7
  • 48
  • 82
Kumar
  • 1,139
  • 2
  • 8
  • 9

1 Answers1

0

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

Community
  • 1
  • 1
Pietro
  • 988
  • 10
  • 19