87,910
社区成员
发帖
与我相关
我的任务
分享
var timer = null;
function sendRequest(){
clearTimeout(timer);
timer = setTimeout(function(){
showLoading();
}, 1000);
$.ajax({
url: xxx,
type: xxx,
success: function(){
clearTimeout(timer);
timer = null;
hideLoading();
},
error: function(){
}
})
}
//这里的LoadingElement是你的Loading层
function showLoading(){
$(LoadingElement).css('display', 'block');
}
function hideLoading(){
$(LoadingElement).css('display', 'none');
}