阻止的跨来源请求:http://api.fixer.io/latest.

Cross-Origin Request Blocked:http://api.fixer.io/latest

本文关键字:http api fixer latest io 请求      更新时间:2023-09-26

阻止跨来源请求:同源策略不允许读取位于的远程资源http://api.fixer.io/latest.(原因:CORS标头"Access Control Allow Origin"不匹配http://winc-mypc’)。有人能帮助解决这个问题吗?

这取决于您正在寻找什么样的解决方案!如果您只需要出于开发目的在Chrome中禁用此功能,您可以使用--disable-web-security标志启动Chrome:

chromium-browser --disable-web-security

最终我使用jquery、得到了解决方案

 $.ajax({
    type: "POST",
    url: 'http://api.fixer.io/latest',
    async:true,
    dataType : 'jsonp',   //you may use jsonp for cross origin request
    crossDomain:true,
    success: function(data, status, xhr) {
         alert(data)
    }
});