var timer;
var threadKey = Math.random().toString().replace("0.", "");//当前进程标识
//下面是查询执行进程的函数
function checkProgress() {
$.ajax({
type: "post",
url: "../../tools/data_copy.ashx?act=check_progress",
dataType: "json",
data: "threadKey=" + threadKey,
success: function (data) {
alert(data.msg);
if (data.msg == "1") {
$(".msg").html(data.msgbox);
}
},
error: function (data, status, e) { }
});
}
//每隔500毫秒查询一次执行状态
timer = setInterval("checkProgress()", 500)
$(function () {
var idlist = "<%=idlist %>";
//AJAX执行一个线程,该线程可能会耗时比较长,因此在执行过程中每隔500毫秒用checkProgress()函数查询一次执行进度,但经检测每次都要等这整个进程结束后checkProgress()才开始执行,是不是因为jquery的ajax模块不支持多线程并发呢?
$.ajax({
type: "post",
url: "../../tools/data_copy.ashx?act=copy_category&threadKey=" + threadKey,
dataType: "json",
data: "idlist=<%=idlist %>&random=" + Math.random(),
success: function (data) {
clearInterval(timer);
},
error: function (data, status, e) {
clearInterval(timer);
$(".msg").append("<br /><font color='red'>× 执行中出错,执行终止</fong>");
}
})
})
解决方案 »
- 关于验证控件问题??
- post 文件时报错 Stream ended unexpectedly
- 出现个比较怪的问题 关于 window.close()的。路过的进来下
- 如何用JScript实现客户端上传文件选择?
- 很急的问题!!用Freetextbox控件编辑存入数据库中的字段,在显示时除了Freetextbox外还有什么控件可以显示???
- 开发像阿里爸爸的网站,能遇到什么样的问题?
- 问一个调用不返回值的存储过程,并产生一张临时表???
- 数组怎样保存在web页面
- IIS7 站点创建应用程序问题
- 关于asp.net发邮件的问题
- asp.net中求GridView与DetailView的结合使用方法
- asp.net DropDownList二级联动问题
这不可能啊,ashx和aspx一样啊,在服务端肯定是能同时响应很多个请求的