Need help retrieving JSON from Wikipedia API [Solved]

Hi all,
I have just begun the ‘wikipedia viewer’ project. Right now I am just trying to display the first search title on the page. So far I just have the search-input field, a search button and a random article button on my page(no CSS or other fancy stuff yet)

No matter what I do, I can’t get the first search result on the screen. My codepen link is

Can anyone tell me what’s wrong with my code? Thanks in advance!

Add &callback=? at the end of getJSON


@jenovs Thanks! That works perfectly.

@jenovs Can you tell me what is the role of &callback=? ?

1 Like

It requests jsonp to get around cross origin issues:


@JacksonBates Thanks for clearing my confusion!