I'm trying to rig together an example JS + JQuery + Ajax project for a friend of mine that calls out to an external API. I just have it hosted on Github Pages. Github recently enabled CORS for pages, but I still don't seem to be able to make cross site requests UNLESS I'm in incognito mode in Chrome.
Here's the Github Page: https://zyshara.github.io/playground/hearthstone-test/
Here's the error I'm getting:
XMLHttpRequest cannot load https://api.hearthstonejson.com/v1/17470/enUS/cards.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://zyshara.github.io' is therefore not allowed access.
Here's the snippit of AJAX:
$.ajax({
url: "https://api.hearthstonejson.com/v1/17470/enUS/cards.json",
success: function(result) {
console.log("Hearthstone API loaded!");
window.hearthstoneJSON = result;
console.log(result);
$(".wait").remove();
main(result);
}
});
Again, the XMLHttpRequest works when I'm in incognito mode in Chrome. I know someone on a different thread said Github support for CORS only works for bare domains. If this is the case, is there any workaround I can use with the API url? Thanks much!
Edit: Alright, so this seems to be an issue with my browser alone. Running Chrome on OS X. Maybe I need to change a flag?