varlongPollingCount;
$(function() {
longPollingCount= 1;
$("#msg").html("第" +longPollingCount+ "次请求......");
longPolling();
});functionlongPolling() {
$.ajax({
type:"POST",
url:"Check.aspx?action=check",
dataType:"text",
timeout:5000,
error:function(XMLHttpRequest, textStatus, errorThrown) {
longPollingCount++;
$("#msg").html("第" +longPollingCount+ "次请求......");if(textStatus== "timeout") {//请求超时
longPolling();//递归调用
}else{//其他错误,如网络错误等
$("#msg").html(textStatus);
longPolling();
}
},
success:function(data, textStatus) {varparent=SimpoWin.GetWinParent();
$("#txt").html("操作完成......");
$("#txt").css("color","red");
setTimeout(function() {
SimpoWin.closeWin();
parent.next(data);
},1000);
}
});
}
margin-bottom: 20px; font-weight: bold;">请等待......