首页 > 代码库 > No 'Access-Control-Allow-Origin' header is present on the requested resource.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Response to preflight request doesn‘t pass access control check: No ‘Access-Control-Allow-Origin‘ header is present on the requested resource. Origin ‘http://localhost:8088‘ is therefore not allowed access.
初学webservice,想在Javaweb项目里调用网上的天气预报服务,结果浏览器控制台出现了以上错误
错误原因很明了,意思是跨域请求不被允许,‘http://localhost:8088‘ 是当前的可用域;故而
var xmlHttp=new XMLHttpRequest();
var url="http://www.webxml.com.cn/WebServices/WeatherWS.asmx";
var soapBody="...略...";
xmlHttp.open(‘get‘,url,true);
xmlHttp.send(soapBody);
会报以上异常。
汗~异想天开了
No 'Access-Control-Allow-Origin' header is present on the requested resource.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。