1

Using API to fetch data in JavaScript, but its giving this error

Cross-Origin Read Blocking (CORB) blocked cross-origin response https://MYURL/admin/orders.json?callback=jQuery33108579100223062108_1529487937348&_=1529487937349 with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.

here is my code

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);
});

NOTE: IN PHP CURL request all things are working fine.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Khaild Bashir
  • 37
  • 1
  • 1
  • 5
  • 1
    `Access-Control-Allow-Origin` and such are **server** headers, not client headers. Your client code cannot self-authorize. – T.J. Crowder Jun 20 '18 at 09:54
  • I would like to raise the issue that this question is not in fact a duplicate. After doing some reading, I have a feeling that CORB and CORS are entirely different things. Also, CORS headers are probably not going to fix this issue. See this draft by the chromium project: https://chromium.googlesource.com/chromium/src/+/master/services/network/cross_origin_read_blocking_explainer.md – Jonny Dec 28 '18 at 12:38
  • @JonnyBest is correct. This must be the third or fourth "answer" in a row that I've found that confused CORS and CORB. They are not the same thing. This question is not a duplicate. – John Smith Aug 23 '20 at 04:37

0 Answers0