日期:2014-05-16  浏览次数:20874 次

关于chrome调试AJAX出现"origin-null-is-not-allowed-access"

在学习AJAX,用jQuery调用load()方法加载另外html文件时,出现了错误Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.XMLHttpRequest cannot load file:///E:/code/JQuery/AJAX/a.html.

?

然后google了一下,在stackoverflow上看到以下解释:

Origin nullis the local file system, so that suggests that you're loading the HTML page that does the load call via a file