JavaScript错误:跨域读取阻止(CORB)阻止了跨域响应

时间:2018-06-20 09:52:12

标签: javascript jquery cors cross-origin-read-blocking

使用API​​在JavaScript中获取数据,但会出现此错误

跨域读取阻止(CORB)阻止了MIME类型为application / json的跨域响应https://MYURL/admin/orders.json?callback=jQuery33108579100223062108_1529487937348&_=1529487937349。有关更多详细信息,请参见https://www.chromestatus.com/feature/5629709824032768

这是我的代码

var settings = {
    "async": true,
    "crossDomain": true,
    "dataType": "JSONP",
    "url": "myurl",
    "method": "GET",
    "headers": {
        "Access-Control-Allow-Credentials": true,
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Methods": "GET",
        "Access-Control-Allow-Headers": "Content-Type",
        "authorization": "Basic ZGNlMzFjMzNkMDJlY2RiZjsdfdsfIxNjc6YzNhYzssdfsdfdfsdfMTU1ZDk4ZGM=",
    }
}
$.ajax(settings).done(function (response) {
    console.log(response);
});

注意:在PHP CURL请求中,一切正常。

0 个答案:

没有答案