Cross-Origin Request Blocked

I’m trying to make a request using Jquery and keep getting the Cross-origin block. I am wondering if this is a problem on my end or if lingq server is denying me access to API.

Error message is at the bottom, any help is much appreciated.

var settings = {
“async”: true,
“crossDomain”: true,
“url”: “https://www.lingq.com/api/languages/en/lessons/108135/text/”,
“method”: “GET”,
“headers”: {
“authorization”: “Token MY_API_KEY”,
“cache-control”: “no-cache”,
},
“Access-Control-Allow-Origin”: “*”
}

$(document).ready(function() {
$.ajax(settings).done(function (response) {
console.log(response);
});
});

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.lingq.com/api/languages/en/lessons/108135/text

my solution was to stop making the request through chrome and instead make it through node js. you could also use postman or whatever lang you want

1 Like

This thread might help:

jQuery ajax request being block because Cross-Origin - Stack Overflow

Try jsonp, but that still may not work if CORS isn’t enabled on Lingq…then I’d do what matchaking suggests.