2

我正在使用 jQuery Validate 插件submitHandler来禁用提交按钮,但是一旦表单提交按钮被禁用,我必须等待 5-10 秒才能将表单发布到其他页面?下面的整个代码,很奇怪?它可能是超时的东西?

        <script src="http://code.jquery.com/jquery-1.7.2.js" type="text/javascript"></script>
        <script src="http://jquery.bassistance.de/validate/jquery.validate.js"></script>
        <script src="http://jquery.bassistance.de/validate/additional-methods.js"></script>   

        <script>

        $( "#UploadForm" ).validate({

  errorLabelContainer: "#messageBox",
  wrapper: "td",

  rules: {  

   name: {
        required: true
         }

  },
  submitHandler: function (form) {

   $('#submit').attr('disabled','disabled');
   form.submit();

}

});
        </script>
4

1 回答 1

17

$('#UploadForm').submit();触发另一轮验证(“太多递归错误”记录在这里:http: //jqueryvalidation.org/documentation/

尝试这个:

submitHandler: function (form) {
   $('#submit').attr('disabled','disabled');
   form.submit();
}
于 2013-08-04T08:44:34.477 回答