表单重复提交解决(是自定义属性实现)

时间:2022-07-07 03:16:58

$("#submit").click(function () {
var nowTime = new Date().getTime();
var clickTime = $(this).attr("ctime");
if (clickTime != 'undefined' && (nowTime - clickTime < 10000)) {
alert('操作过于频繁,稍后再试');
return false;
} else {
$(this).attr("ctime", nowTime);
var mainForm = $("#submit").parent().parent();
mainForm.submit(function () {
if (mainForm.valid()) {
$("#submitloading").show();

} else {
$(".validation-summary-errors").hide(8000);
}


});
}
});