I have this html code:
<form name="input" action="html_form_action.asp" method="post" id="formID">
Username: <input type="text" name="user" />
<input type="submit" value="Submit" />
</form>
<script>
for (i=0;i<10;i++) {document.getElementById('formID').submit; }
</script>
I'm trying to submit the same thing several times.
But as you can guess, it always submits once, and refresh the page.
How can I avoid this and submit as many times I want?
Try this:
Replace formname with the name of the form Peplace url1 and url2
Use AJAX to send requests silently to the server (i.e. without a refresh).
or instead of submitting the form 10 times, why not move the loop into your ASP file - your form submits once and something happens 10 times over on the server.
What are you trying to do?
In addition to using Ajax, you could also set the target of the form to "_blank", causing the form to submit to a new window or tab.
The browser can open as many windows as you let it so you could go on for a while.
This would be incredibly annoying to a user though. I hope you know what you're doing.
You must submit form by Ajax. use JQuery.Ajax
visit: http://api.jquery.com/jQuery.ajax/ for other setting