0
I have a form and wanted that when being loaded the page, that form was submitted. I’m using the code below, but it’s in an infinite loop.
<form name="teste" action="inicial" method="post">
Nome do Usuário: <input type="text" name="user">
<input type="submit" value="Enviar">
</form>
JS
$(document).ready(function () {
window.onload = function() {
document.forms[0].submit();
}
});
When I load the page, it submits endlessly. I thought I’d only execute once.
tries to take out the window.onload = Function() { } and take the form with a $('form' selector). Ubmit();
– edson alves
If the request is going to the page itself, it will give an infinite loop, because it will submit to itself, and when it loads it will do it again. so eternally.
– edson alves