How to submit a form without refreshing the page using JavaScript.
How to submit a form without refreshing the html page using JavaScript.
Whenever you create a html form and want to submit that form, the page automatically refreshes. But if you want to submit a form without page refresh using JavaScript, then in this article, I'm going to share how you can prevent page reload on form submit in Js.
Sometimes, we want to execute a function without refreshing the page. So we have to prevent the html page to reload by using return false;.
return false; prevents the default behaviour. In this example, it prevents to submit the form.
Submit a form without refreshing
<form action="#" onsubmit="myFunction();return false"> <input type="text" placeholder="Enter Your Name"/> <input type="submit" value="submit"/> </form> <script> function myFunction() { alert("Form Submitted") ; } </script>Try it Yourself »
save
listen
AI Answer
How to submit a form without refreshing the page using JavaScript.
0
How to submit a form without refreshing the html page using JavaScript. Whenever you creat…
asked
Apu
0 answers
2915
How to submit a form without refreshing the html page using JavaScript. Whenever you creat…
Answer Link
answered
Apu