且构网

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

jQuery ajax表单提交多次

更新时间:2022-12-07 09:17:55

ajaxForm绑定应该只进行一次。
尝试将ajaxForm绑定放在$(document).ready事件上并尝试重构逻辑。每次单击 .flag 元素时都会绑定ajaxForm,并且所有先前绑定的ajaxForm都会在所有后续点击事件中被调用。

ajaxForm binding should be done once only. Try to put the ajaxForm binding on $(document).ready event and try to restructure your logic. ajaxForm was bind every time you click .flag element and all previously bind ajaxForm would be called on all succeeding click event.