Wikipedia API Help Needed! [Solved]

Wikipedia API Help Needed! [Solved]
0.0 0

#1

Hello,

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: https://codepen.io/Nitin-Chandran-Nair/pen/JKrgJB

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

Thanks in advance,
Nitin


#2

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

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


#3

Nitin,

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!


#4

Ouch!!

Thanks buddy! :slight_smile:


#5

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:


#6

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


#7

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