I know other questions like mine have been asked and answered, and most of them suggested adding "Access-Control-Allow-Origin": "*"
into the header. However, even after doing so, I'm still getting the error: `Response to preflight request doesn't pass access control check: No Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.
My script is very simple. It's only the following:
var url = 'https://www.goodreads.com/search.xml?key=[MY_KEY]&q=Ender%27s+Game';
fetch(url, {headers: {"Access-Control-Allow-Origin" : "*",}}).then(function(result){
console.log(result);
});
When I access the site by just passing in url
into the browser, I get a response. Therefore, I know that my security credentials are fine.
I'm not sure hat to do. Anyone have any suggestions?