Submit form automatically [duplicate]

Multi tool use
Submit form automatically [duplicate]
This question already has an answer here:
hey can anyone help me
I would like to automatically submit the form on page load is there anyway it could be done?
<form method='post' action='/delete-account.php'>
<input type="submit" id="submit" name="submit" value="Confirm Account Removal" /></form>
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2 Answers
2
<form method='post' name="myForm" id="myForm" action='/delete-account.php'>
<input type="submit" id="submit" name="submit" value="Confirm Account Removal" /></form>
window.onload=function(){
document.forms["myForm"].submit();
}
did you get any error??
– Siva Ganesh
Jul 3 at 5:10
Thanks! but i now got it working i added / edit document.getElementById("submit").click();
– Mike Jones
Jul 3 at 5:36
Have a great day
– Siva Ganesh
Jul 3 at 5:44
You can submit this way by using the jquery
<html>
<head>
https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
$(document).ready(function(){
document.getElementById("myDataForm").submit();
});
</head>
<body>
<form method='post' id="myDataForm" name="myDataForm" action='/delete-account.php'>
<input type="submit" id="submit" name="submit" value="Confirm Account Removal" /></form>
</body>
</html>
Please try this.
unfortunately it didn't work but thanks for the help / fast reply
– Mike Jones
Jul 3 at 4:50
Have a look at question tag, he is not mentioning jquery
– Siva Ganesh
Jul 3 at 5:01
@MikeJones please try now i have changed something on the answer. Definitely it will work
– Pranav MS
Jul 3 at 5:02
nope that also didn't work
– Mike Jones
Jul 3 at 5:06
i gave it a try and it didn't work
– Mike Jones
Jul 3 at 5:07