报错:XMLHttpRequest cannot load file...

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

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

 

缘由:服务器

Chrome不支持本地Ajax请求。chrome-extension

 

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

2. 使用Firefox调试htm