【发布时间】:2014-05-01 18:32:45
【问题描述】:
您好,我必须执行类似的操作,当 ajax 正在进行时,不允许用户刷新页面。
这是我的代码
$('#submit').click(function() {
$(function() {
$(".col1").mask("Generating csv...."); //This will generate a mark, Here i would like to prevent the user from doing any sort of operation.
var to = $('#filters_date_to').val();
var from = $('#filters_date_from').val();
$.ajax({
url:"../dailyTrade/createCsv?filters[date][to]="+to+"&filters[date][from]="+from,success:function(result){
if(result) {
$(".col1").unmask(); //Here we can unlock the user from using the refresh button.
window.location = '../dailyTrade/forceDownload?file='+result;
setTimeout('location.reload(true);',5000);
}
}
});
});
});
任何建议。
【问题讨论】:
-
如果您指的是浏览器的“刷新”按钮,那么您不应该这样做。
标签: javascript jquery ajax