没有access-control-allow-origin标头存在于同一文件夹中

时间:2014-02-22 14:26:09

标签: jquery css ajax html

我知道这个问题已被多次询问,这是由于同源策略但是我的文件是我的计算机硬盘驱动器上的正常.html文件在同一文件夹上,我仍然收到此错误!

<script>
    $(function() {
        $("#some").load("include.html");
        });
</script>

并且include.html只有一个<p>标记,其中包含一些文字。我已下载jQuery并将其包含在内!我可以运行其他脚本但这会导致以下错误:

    Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.        file:///C:/Users/MYUSER/Documents/code/include.html
    XMLHttpRequest cannot load file:///C:/Users/MYUSER/Documents/code/include.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. 

正如您所看到的,它们位于同一个文件夹中,但我仍然遇到此错误。我将Chrome用作浏览器!

some是我页面正文中div标签的id

0 个答案:

没有答案