Dojo JsonRestStore、fetch、OneError回调和HTTP状态代码?
我想知道如何获取执行fetch()操作后返回的HTTP状态代码。我已经为fetch()调用指定了onComplete和onError回调。 出现错误时会调用onError,但我无法从传递给onError的参数中获取HTTP状态代码(这只是请求,而不是响应) 使用XhrGet,我能够从ioArgs获取状态代码,而JsonRestStore似乎没有这样处理它Dojo JsonRestStore、fetch、OneError回调和HTTP状态代码?,dojo,Dojo,我想知道如何获取执行fetch()操作后返回的HTTP状态代码。我已经为fetch()调用指定了onComplete和onError回调。 出现错误时会调用onError,但我无法从传递给onError的参数中获取HTTP状态代码(这只是请求,而不是响应) 使用XhrGet,我能够从ioArgs获取状态代码,而JsonRestStore似乎没有这样处理它 我使用的是Dojo1.5.1(我确实还不能升级到1.6)错误处理程序有两个参数。第二个参数(我称之为config)有一个名为xhr的属性,其中
我使用的是Dojo1.5.1(我确实还不能升级到1.6)错误处理程序有两个参数。第二个参数(我称之为config)有一个名为xhr的属性,其中包含。。。状态和状态文本
dojo.xhrGet({
url:'/bogusPath/',
error:function(error, config){
console.log('XHR-ErrorHandle',arguments);
console.log('XHR-ErrorHandle-status:',config.xhr.status);
console.log('XHR-ErrorHandle-statusText:',config.xhr.statusText);
}
})
返回:
XHR ErrorHandle[错误,对象]
XHR ErrorHandle状态:404
XHR ErrorHandle statusText:未找到错误处理程序有两个参数。第二个参数(我称之为config)有一个名为xhr的属性,其中包含。。。状态和状态文本
dojo.xhrGet({
url:'/bogusPath/',
error:function(error, config){
console.log('XHR-ErrorHandle',arguments);
console.log('XHR-ErrorHandle-status:',config.xhr.status);
console.log('XHR-ErrorHandle-statusText:',config.xhr.statusText);
}
})
返回:
XHR ErrorHandle[错误,对象]
XHR ErrorHandle状态:404
XHR ErrorHandle statusText:未找到