Wikipedia API Help Needed! [Solved]


After a lot of struggling through the Wikipedia API, I was finally able to create the “URL” needed to fetch the necessary data.

The API sandbox returns the results perfectly, however the codepen returns a blank object.

Here’s the link:

Can someone please tell me what’s wrong with my Ajax call?

Thanks in advance,

Hi :slight_smile:
is not returning a blank object, try:

[line 24] console.log(data.query.pages);

1 Like


It actually seems to be working just fine, it’s just that Codepen’s console often limits the results in their console.log. If you open up the dev tools for your browser (F11 on Chrome on PC) then you will see an object that you can then unfold and extract data from.

For example, you can use a for loop on the output of data.query.pages to return the title and extract (description).

Happy coding!

1 Like


Thanks buddy! :slight_smile:

1 Like

Thanks a lot! It helped!!

I feel like a stupid right now! :slight_smile:

I have been trying to debug this since two days. :frowning:

It’s part of the cycle of a programmer. Trust me, that sort of frustration pays off in your patience in the future.

1 Like

yeah, I feel so excited and happy right now :smiley: