If you are using a input type=”submit” button, then you need to do a return false; at the end of the function to prevent it from submitting.
How do I stop a form from submitting AJAX?
If you are using a input type=”submit” button, then you need to do a return false; at the end of the function to prevent it from submitting.
How do I stop submitting a form?
The simplest solution to prevent the form submission is to return false on submit event handler defined using the onsubmit property in the HTML