读书人

XMLHttpRequest对象status=0

发布时间: 2012-02-21 16:26:23 作者: rapoo

XMLHttpRequest对象status=0 - Web 开发 / Ajax
status=0 真的是本地响应成功吗 ?
我怎么感觉不是啊 ! 那本地响应不成功是什么呢?

[解决办法]
0跟http请求里面的200相同,参见
https://developer.mozilla.org/En/Using_XMLHttpRequest
[解决办法]
The status attribute must return the result of running these steps:

1、If the state is UNSENT or OPENED return 0 and terminate these steps.

2、If the error flag is true return 0 and terminate these steps.

3、Return the HTTP status code.





[解决办法]
未通过服务器返回成功执行返回的状态为0,如果找不到请求的文件会出错~~

通过服务器访问的返回http协议定义的状态,如404找不到,200成功执行等。。

读书人网 >Ajax

热点推荐