Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Auto Submit Form Demo</title> </head> <body> <form id="autoSubmitForm" action="javascript:void(0);"> <input type="hidden" name="data" value="Automatic Submission"> </form> <script> function submitFormAutomatically() { document.getElementById('autoSubmitForm').submit(); alert("Form submitted with data: " + document.getElementById('autoSubmitForm').data.value); } window.onload = submitFormAutomatically; // Call the function when the page loads </script> </body> </html>