<form name="myForm" id="myForm" action="test.php" method="POST">
<p>
<input name="test" value="test" />
</p>
<p>
<input type="submit" name="submit" value="Submit" />
</p>
</form>
<script>
var auto_refresh = setInterval(
function()
{
submitform();
}, 10000);
function submitform()
{
alert('test');
document.myForm.submit();
}
</script>
I'm having trouble trying to auto-submit a form every 10 seconds once landed on a page. The form name is myForm action="test.php"
. I get the 'test'
message but the page doesn't submit the form.
Any solutions besides autoloading the function upon page load?
FIXED: Removed (name="submit"
) from the submit button and it worked smoothly.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…