简体   繁体   English

Dojo考虑XHR请求错误是什么?

[英]What does Dojo consider a XHR request error?

When doing AJAX through Dojo we can pass two callbacks, one to execute after a successfull request and one to execute after an error: 通过Dojo执行AJAX时,我们可以传递两个回调,一个在成功请求后执行,另一个在错误后执行:

dojo.xhr("GET",{
    url: myURL,
    content: messageContents,
    load: function(returnData, ioArgs){
        //This is called on success
    },
    error: function(returnData, ioArgs){
        //This is called on failure
    }
});

I couldn't find in the documentation what is defined as an error . 我在文档中找不到什么被定义为错误 I'd guess anything with a return code >= 400 but I'm not sure. 我猜任何返回码> = 400的东西,但我不确定。

Generally speaking, an unsuccessful HTTP response code. 一般来说,HTTP响应代码不成功。 The determination is made by calling dojo._isDocumentOk which as you'll see basically accepts 2xx and 304 plus some browser-quirk stuff. 通过调用dojo._isDocumentOk确定 ,你会看到它基本上接受2xx和304以及一些浏览器怪异的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM