Error: CORS policy: No 'Access-Control-Allow-Origin' header is present in ionic 4
Error: CORS policy: No 'Access-Control-Allow-Origin' header is present in ionic 4
从来源 'localhost' 访问 'myURL' 处的 XMLHttpRequest 已被 CORS 策略阻止:请求的资源上不存在 'Access-Control-Allow-Origin' header。
源代码
this.http.get(login_url ).subscribe(data => {
this.responseArray = data;
console.log(this.responseArray.SINGLE_HOTEL_APP[0].success);
});
我正在使用 ionic HTTP 插件
要么你把你的网站api header ('Allow-Access-Origin:')
或将其与 ionic 的请求一起作为采用 new HttpHeaders().set('Allow-Access-Origin:') 的选项发送;
这就是 all.Any 更多详细信息,我已经准备好了。
从来源 'localhost' 访问 'myURL' 处的 XMLHttpRequest 已被 CORS 策略阻止:请求的资源上不存在 'Access-Control-Allow-Origin' header。
源代码
this.http.get(login_url ).subscribe(data => {
this.responseArray = data;
console.log(this.responseArray.SINGLE_HOTEL_APP[0].success);
});
我正在使用 ionic HTTP 插件
要么你把你的网站api header ('Allow-Access-Origin:') 或将其与 ionic 的请求一起作为采用 new HttpHeaders().set('Allow-Access-Origin:') 的选项发送; 这就是 all.Any 更多详细信息,我已经准备好了。