New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加.holdSubmit()方法,用来防止表单重复提交 #36

Closed
niceue opened this Issue Sep 17, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@niceue
Copy link
Owner

niceue commented Sep 17, 2013

$("#myForm").validator({
    valid: function(form){
        var me = this;
        // 提交表单之前,hold住表单,防止重复提交
        me.holdSubmit();

        $.ajax({
            url: "xxx.php",
            data: $(form).serialize(),
            type: "POST",
            success: function(){
                // 提交表单成功后,释放hold
                me.holdSubmit(false);
            }
        });
    }
});
@petanne

This comment has been minimized.

Copy link

petanne commented Apr 27, 2016

@niceue 测试发现,在0.10.5版本,连续点击两次提交按钮,第一次holdSubmit正常,第二次无效并直接触发原生form post action了,猜测可能与validate缓存有关?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment