简体   繁体   English

XMLHttpRequest无法加载。 Access-Control-Allow-Origin不允许起源

[英]XMLHttpRequest cannot load. Origin is not allowed by Access-Control-Allow-Origin

Im using this code to call json file, i checked it with jslint "Results : Valid JSON", it is correct, I used it few months, but today suddenly stopped working, the console shows this. 我使用此代码调用json文件,我用jslint“ Results:Valid JSON”检查了它,这是正确的,我用了几个月,但今天突然停止工作,控制台显示了此信息。

XMLHttpRequest cannot load http://www.weburl.com/web/calc/filethree.js . XMLHttpRequest无法加载http://www.weburl.com/web/calc/filethree.js Origin http://www.weburl.com/ is not allowed by Access-Control-Allow-Origin. Access-Control-Allow-Origin不允许使用来源http://www.weburl.com/

$.getJSON("http://www.weburl.com/web/calc/filethree.js",function(datathree){
        $.each(datathree, function(i,value){
        // do something
        });
        }
);

Im newbie in jquery, I searched some info, tried callback= , but nothing .. :/ 我是jquery的新手,我搜索了一些信息,尝试了callback =,但是什么都没有..:/

With callback I get 404 error 与回调我得到404错误

http://www.weburl.com/web/calc/filethree.js&callback=jQuery180014668452506884933_1349693824272?_=1349693824434

I dont know what happened It worked prefectly yesterday :/ 我不知道发生了什么事。

I changed the url, and now Im now using relative URL , @devnull69 advise was helpfull, and now it is works. 我更改了网址,现在我现在使用相对网址,@ devnull69提示是有帮助的,现在可以了。 Solution: Try the relative URL web/calc/filethree.js instead of the absolute one – by @devnull69 解决方案:尝试使用相对URL web / calc / filethree.js而不是绝对URL –通过@ devnull69

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 XMLHttpRequest无法加载。 请求的资源上不存在“Access-Control-Allow-Origin”标头。 因此不允许原点访问 - XMLHttpRequest cannot load. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access Google Translate API:无法加载XMLHttpRequest。 Access-Control-Allow-Origin不允许来源http://test.dyndns.org - Google Translate API: XMLHttpRequest cannot load. Origin http://test.dyndns.org is not allowed by Access-Control-Allow-Origin AccessAccess-Control-Allow-Origin不允许XMLHttpRequest无法加载 - XMLHttpRequest cannot load is not allowed by Access-Control-Allow-Origin XMLHttpRequest无法加载。 不存在“ Access-Control-Allow-Origin”标头。 (阿帕奇/ jQuery的/ AJAX) - XMLHttpRequest cannot load. No 'Access-Control-Allow-Origin' header is present. (Apache/jQuery/AJAX) XMLHttpRequest无法加载http:// localhost:8089 / jquery。 Access-Control-Allow-Origin不允许使用原点null - XMLHttpRequest cannot load http://localhost:8089/jquery. Origin null is not allowed by Access-Control-Allow-Origin XMLHTTPRequest无法加载http:// ...原始http:// localhost:Access-Control-Allow-Origin不允许使用端口 - XMLHTTPRequest cannot load http://… Origin http://localhost:port is not allowed by Access-Control-Allow-Origin jQuery使用WCF。 错误:XMLHttpRequest无法加载Access-Control-Allow-Origin不允许使用Origin null - Jquery to consume WCF. error: XMLHttpRequest cannot load Origin null is not allowed by Access-Control-Allow-Origin XMLHttpRequest无法加载来源Access-Control-Allow-Origin不允许使用来源http://m.snapbatch.com - XMLHttpRequest cannot load Origin http://m.snapbatch.com is not allowed by Access-Control-Allow-Origin XMLHttpRequest无法加载…Access-Control-Allow-Origin不允许使用Origin null - XMLHttpRequest cannot load… Origin null is not allowed by Access-Control-Allow-Origin XMLHttpRequest无法加载url Access-Control-Allow-Origin不允许使用Origin null - XMLHttpRequest cannot load the url Origin null is not allowed by Access-Control-Allow-Origin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM