报错:XMLHttpRequest cannot load file...

在练习《jQurey基础教程》chapter6时,使用Chrome调试发生错误:

XMLHttpRequest cannot load file:///D:/Web/jQuery%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B4th/chapter6/a.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

 

原因:

Chrome不支持本地Ajax请求。

 

解决方法:
1. 将html页面部署到服务器再访问

2. 使用Firefox调试

posted @ 2017-05-17 10:27  MagicMai  阅读(246)  评论(0编辑  收藏  举报