是可以同时提交两份表格? [英] Is to possible to submit two forms simultaneously?
本文介绍了是可以同时提交两份表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
时尽可能用JavaScript或一个提交按钮?同时提交两种形式
Is to possible to submit two forms simultaneously with either javascript or a submit button?
表结构是确定这样的:
<form name="form1" method="post">
.........
</form>
<form name="form2" method="post">
.........
</form>
,并从两个数据的阵列?
And get the data from the two in a array?
推荐答案
没有,这是不可能的。您可以创建第三个隐藏的形式,将序列化的字段从他们两个。
No, this is not possible. You can create a third hidden form, that will serialize fields from both of them.
如果您可以使用jQuery:
If you can use jQuery:
var str1 = $("form1").serialize();
var str2 = $("form2").serialize();
$.post(url, str1 + "&" + str2);
您需要确保str1和str2的是不是空的,当然,避免这两种形式之间的名称冲突。
You need to make sure that str1 and str2 aren't empty and of course avoid name conflicts between the two forms.
这篇关于是可以同时提交两份表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文