ajax的递归查询,从ajax成功递归调用另一个ajax函数

我有一个用于请求报告的网页。当用户点击一个按钮时,我正在调用一个函数,它会发出一个ajax请求来处理这些报告。一旦请求完成,我使用setInterval函数每隔1秒检查报告的状态(是否完成)。一些如何,setInterval()中的函数根本不被调用。从ajax成功递归调用另一个ajax函数

以下是JavaScript代码,我有

var GLFiles_JSObject = {

url: "/AjaxRequest.aspx",

apppath: '',

btnRefreshId: '',

ajaxFunctionName: 'GLBuilder_ReprocessFiles',

reportstatusFuncName: 'GLBuilder_GetReportStatus',

reportid: 0,

ajaxError: function(XMLHttpRequest, textStatus, errorThrown){

alert(XMLHttpRequest.statusText);

},

ajaxSuccess: function(msg) {

if (msg === '') {

setInterval(function(){

this.reportstatus();

}, 1000);

}

},

reportstatusSuccess : function(msg) {

if (msg === '1') {

clearInterval();

}

},

reportstatus : function() {

var keys = new Array('reportid');

var values = new Array(reportid);

//ajax call

WebServicePost(true, this.url, this.reportstatusFuncName, keys, values, this.ajaxError, this.reportstatusSuccess);

}

};

//this will be called when button is clicked.

function reprocessGLFiles(reportid, btnid) {

//disable the button

//$('#' + btnid).attr("disabled", true);

GLFiles_JSObject.reportid = reportid;

var keys = new Array('reportid');

var values = new Array(GLFiles_JSObject.reportid);

// make an ajax request to process the files

WebServicePost(true, GLFiles_JSObject.url, GLFiles_JSObject.ajaxFunctionName, keys, values, GLFiles_JSObject.ajaxError, GLFiles_JSObject.ajaxSuccess);

return false;

}

2011-05-23

Sridhar

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值