本文介绍了JavaScript:发送多个子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个HTML代码:
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>
我试图多次提交同样的东西。
但是as你可以猜到,它总是提交一次,并刷新页面。
如何避免这种情况并提交我想要的次数?
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?
推荐答案
使用AJAX以静默方式向服务器发送请求(即无需刷新)。
Use AJAX to send requests silently to the server (i.e. without a refresh).
或代替提交表单10时间,为什么不将循环移动到你的ASP文件中 - 你的表单提交一次,在服务器上发生了10次。
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.
你想做什么?
这篇关于JavaScript:发送多个子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!