最近在做一个asp.net实时进度条遇到的问题
function importExcel() {
if (!checkForm()) {
return false;
}
$.ajax({
url: "/API/BackProcess.ashx",
type: "POST",
dataType: "json",
data: {
action: "ImportExcel",
excelFilePath:$("#ctl00_contentHolder_fpExcel").val(),
cusType: $("#ddlCusType").val(),
relateID: $("#ddlRelation").val(),
state: $("#ddlStatu").val(),
fromUserID: $("#ctl00_contentHolder_hmSelect_hfUserID").val(),
},
success: function (info) {
if (info.success) {
}
else {
ShowMsg(info.ErrMsg, false);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
closeBg();
ShowMsg("错误信息:" + errorThrown, false);
}
});
setTimeout(getProgress(),20);
}
function getProgress() {
alert("bbbbb");
$.ajax({
url: "/API/BackProcess.ashx",
type: "POST",
data: { action: "GetProgress" },
success: function (width) {
if (width != "-1") {
//工作没有结束,继续查询进度
//setTimeout(getProgress(), 20);
$("#progressbar").css("width", width + "%");
$("#progressbar").text(width + "%");
} else {
//工作完成
$("#progressbar").css("width", "100%");
$("#progressbar").text("100%");
}
}
});
精慕HU