[英]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.