问题描述
在response.end()客户端脚本将永远无法运行。
使用Response.write和Response.end时,是否还有其他方法可以显示隐藏加载程序?
1楼
一种常见的方法是在调用Response.End()之前在服务器上设置cookie。
HttpCookie fileDownloadToken = new HttpCookie("fileDownloadToken", "1");
然后创建一个间隔以检查该cookie是否存在
function btnSubmit_Click() {
// Show loader
// Submit to server
fileDownloadCheckTimer = window.setInterval(function () {
if ($.cookie('fileDownloadToken') == '1') {
window.clearInterval(fileDownloadCheckTimer);
$.removeCookie('fileDownloadToken', { path: '/' });
// Hide loading panel here
}
}, 1250);
}