Ajax: xmlHttp.status问题

来源:互联网 发布:js调用js也会跨域吗 编辑:程序博客网 时间:2024/05/09 01:01

1. xmlHttp.status=0

初学《Ajax基础教程》下载的书本源文件例子运行后,直接打开innerHTML.html,点击按钮,毫无反应,

经alert ()知 xmlHttp.status状态是0,查后文档上也没有关于这种状态的说明。

后尝试把dist/下的war放到tomcat的webapp下,启动tomcat,通过localhost访问要访问的html,例子就可以运行。

2.xmlHttp.status=500

在运行YahooSearch那个例子时,运行报错,alert()后知status=500,查看YahooSearchGatewayServlet.java

修改RequestUrl:   "http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=thunderboltsoftware"

为 "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=  ",

结果依然不能运行,估计是appid的问题。

3.互联网HTTP连接等出错代码大全

http://bbs.okajax.com/viewthread.php?tid=1043&extra=page%3D1

 

原创粉丝点击