最近使用ajax的时候,由于是在本地测试调用 后台时一直会报错。web
解决方案:用谷歌浏览器 以非安全的模式打开ajax
在cmd命令行中 cd 到谷歌的安装目录下 (右键 属性 复制路径) 而后在 运行以下命令 chrome -args --disable-web-security 就可使谷歌以非安全的方式运行(会弹出一行黄色的警告),能够支持本地文件请求ajax 若是你的谷歌目录没有在C:\Program Files (x86)下请自行修改 cd "C:\Program Files (x86)\Google\Chrome\Application\ c: chrome -args --disable-web-security苹果电脑下:open -a "Google Chrome" —args —disable-web-security