当前位置:Gxlcms > 数据库问题 > No 'Access-Control-Allow-Origin' header is present on the requested resource.

No 'Access-Control-Allow-Origin' header is present on the requested resource.

时间:2021-07-01 10:21:17 帮助过:30人阅读

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.

标签:oca   request   浏览器   open   原因   网上   head   new   http   

人气教程排行