I am clicking on Submit button my form is getting submitted. I just wanted to submit the details, but not to visit the backend page or popup in it that the data have been submitted.
<form action="functionality\app_details.php" method="post">
<!-- Name -->
<div >
<div >
<span >Name</span>
</div>
<input type="text" name="name" id="inputName" placeholder="Enter name">
</div>
<!-- Parent's name -->
<div >
<div >
<span >Parent's Name</span>
</div>
<input type="text" name="Fname" id="inputFname" placeholder="Enter Father's Name">
<input type="text" name="Mname" id="inputMname" placeholder="Enter Mother's Name">
</div>
<button type="submit" >submit</button>
</form>
</div>
CodePudding user response:
if you want to just submit it and nothing happen. just leave the action empty so it won't go anywhere.
you can also do this if you want the page not to refresh:
document.getElementById("enter you button id here").addEventListener("click", function(event){
event.preventDefault()
});
CodePudding user response:
The data is sent to the page you put in action tag.. If you want to send the data to the same page
<form action="" method="post">
...
</form>
or use Ajax.