开发者

Using jQuery Form plugin, how do I prevent form resubmission temporarily?

开发者_StackOverflow中文版

I'm using the jQuery Form plugin to install an event handler for form submission. However, I need to disable resubmission of the form until I receive an event that the server has finished processing. How do I do this?


$("#submit").click(function(){
    $(this).attr('disabled', 'disabled');
});

will do the stuff


I solved it by introducing a JavaScript variable allowSubmit, which is initially true. After form submission it is false, making my submission handler not do anything. When the server responds to the submission, allowSubmit is reset to true.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜