如何通过单一提交提交多个表单? [英] how to submit multiple forms with single submit?
本文介绍了如何通过单一提交提交多个表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在同一页面上有多个表单,但我想一次提交所有表单,而不是一次提交一个表单。我的方法是克隆另一个表单中的所有数据,并立即提交,但其开销类型。那么,是否有另一种方法来提交多个表单数据一次。
感谢您提供任何帮助。
当点击'按钮'
'时,这将通过ajax提交所有表单元素。
($($'$'$>'$')$ this.action,$ form.serialize());
});
});
请注意,这不会刷新页面,因为它们都是通过ajax提交的...... p>
I have multiple forms on the same page but I want to submit all forms together once instead of submitting one at a time. My approach is to clone all the data inside a another form and submit at once but its kind of overhead . So, is there a another approach to submit multiple form data once.
Thanks in advance for any help.
解决方案
This will submit all form elements via ajax when 'button'
is clicked
$('button').click(function() {
$('form').each(function() {
$.post(this.action, $form.serialize());
});
});
Note that this will not refresh the page, as they are all submitted via ajax...
这篇关于如何通过单一提交提交多个表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文