You can call the preventDefault function on the event target and it will stop the form from redirecting to the page specified in the action attribute of the <form> tag.
<form method="POST" action="your-page.php" onsubmit="onFormSubmit();"> <input type="submit" /> </form>
2. return false
<form method="POST" action="your-page.php" onsubmit="return onFormSubmit();"> <input type="submit" /> </form>
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post