相关疑难解决方法(0)

jQuery .load的回调函数中textStatus参数的所有可能值是什么?

我正在利用jQuery的.load方法的回调函数来运行某些代码,如果方法的textStatus参数.load等于某个字符串.

我有

jQuery("#myContainer").load('/seperate-file-with-content.asp', function(responseText, textStatus, xhr){                     
    if (textStatus === "error" || responseText.length <= 0) {
        //file failed to load i.e. textStatus == error 
        //or file loaded but has no content
    } else {
        //file loaded successfully i.e. textStatus == success
    }       
});
Run Code Online (Sandbox Code Playgroud)

但我担心声明中的else部分if可能会捕获其他textStatus不等于的非预期值success.

除了error和之外,textStatus还有其他可能的值success吗?

编辑/ UPDATE:由于我现在相信,.load是基于.ajax,在以下问题的答案可能是使用的其他任何人有类似的问题: - 在jQuery的阿贾克斯成功回调,将永远textStatus不会是"成功"?

jquery

11
推荐指数
1
解决办法
5863
查看次数

标签 统计

jquery ×1