针对重复提交问题,可设置状态位,用定时器控制,详见代码:
clicktag = 0;//状态
if (clicktag == 0) {
ajaxAction(url, "json",data, function(ret){
if(ret.success==true){
clicktag = 1;
obj.addClass("a_bb");//通过添加样式,来提醒按钮暂时失效
setTimeout(function () { clicktag = 0;obj.removeClass("a_bb"); }, 5000);
}else{
alert(ret.msg);
}
},"pl");
}
/* 防按钮频繁点击 */ .a_bb{background-color: grey;cursor:default} .a_bb:hover{background-color: grey;cursor:default}
转载于:https://my.oschina.net/maoguangdong/blog/744073
