Need help with the Wiki API

So I have just started the Wikipedia API challenge and I just don’t understand why my code is not logging my API back to me in the console. I have done it this way in the previous two challenges, but for some reason it will just not log this one. If someone could look at my code/code pen and let me know that would be great :smiley:

var api = “https://en.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&titles=Post%20Malone&rvprop=content”;

$(document).ready(function() {

getWiki();

function getWiki() {
$.ajax({
url: api,
success: function (result) {
console.log(api);
}
});
}

});

https://codepen.io/bstranc/pen/WXYzNG

Hey @bstranc,
first of all, I would put the api string with the double quotation marks and not the ones you used.
Second, when I ran your code, I got :

No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.

This is because you are trying to make an XMLHttpRequest to a different domain than your page is on. To bypass this issue, you need to use CORS.

You can read more about it here.

Hope that helps.