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

$("#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);
}


});
}
});

posted @ 2017-01-19 14:20  海中松树  阅读(295)  评论(0编辑  收藏  举报