jQuery如何阻止表单重复提交?

jQuery如何阻止表单重复提交?具体看如下代码:

 

$(document).ready(function() {
$('form').submit(function() {
    if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
      jQuery.data(this, "disabledOnSubmit", { submited: true });
      $('input[type=submit], input[type=button]', this).each(function() {
        $(this).attr("disabled", "disabled");
      });
      return true;
    }
    else
    {
      return false;
    }
  });
});
posted @ 2013-07-18 11:26  bytjj  阅读(411)  评论(0编辑  收藏  举报