var timer;
//点击某个点击事件,定时操作开始
$(".iconqrA").on("click",function(){
setIntervalIndex();//定时操作开始$.ajax({
url : base+"/enterUser/ajax/createQrcode.htm",
data : {
userName:userName
},
type : "POST",
dataType : "json",
cache : false,
async : false,
success : function(data) {
if (data.success == 0) {
} else if (data.success == 1) {
window.location.href = base +"/register/index.htm";
return;
}else if (data.success == 2) {
alert("","系统繁忙,请稍后再试","fail");
return;
}
}
});
});
//点击某个操作,停止定时操作
$(".qrcodeN").on("click",".iconclose",function(){
clearInterval(timer);
timer = null;
})
//定时function
function setIntervalIndex(){timer = setInterval(function() {
$.ajax({
url : base+"/enterUser/ajax/queryQrcode.htm",
data : {},
type : "POST",
dataType : "json",
cache : false,
async : false,
success : function(data) {
if (data.success == 0) {
//操作成功后,取消定时
clearInterval(timer);timer = null;
} else if (data.success == 1) {
window.location.href = base +"/register/index.htm";
return;
}else if (data.success == 2) {
alert("","系统繁忙,请稍后再试","fail");
return;
}
}
});
}, 5000);
}