且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在表单提交后继续运行执行?

更新时间:2022-03-14 05:44:39

基本规则是经典表单提交会停止页面脚本的所有执行,并加载下一页。无法做任何事情。

The basic rule is that a classical form submission halts all execution of scripts of the page, and loads the next page. No way to do anything about that.

您可能必须切换到使用Ajax发送表单的内容。这将使当前页面保持活动状态,并允许您根据需要进行多次提交。

You may have to switch to sending your form's contents using Ajax. That will leave the current page alive, and allow you to do as many submits as you want to.

实现此目的的一种非常简单的方法是 jQuery表单插件。这需要花费大量的手动麻烦。

A very easy way to achieve this is the jQuery form plugin. It takes much of the manual hassle out of the process.