Wikipedia viewer - problem parsing json data

Wikipedia viewer - problem parsing json data
0.0 0

#1

I am having a problem parsing the json data. I am able to form the search url okay to search wikipedia api. I also can successfully open the url in a new window to view the json data. However the search result never appears on my wikipedia viewer app. How can I fix this?

My codepen link is here for my wikipedia viewer

Thank you,
Kevin


#2

Hey. Check the output of the request more carefully. It should be json.query.search and not json.search. Also, you don’t need the cors website; you can just pass the origin=* parameter in the wikipedia URL like:

var url = 'https://en.wikipedia.org/w/api.php?origin=*&action=query&utf8&list=search&format=json&srsearch='

See the post below for more info about it:


#3

That solved my problem. I appreciate your help. Thank you also for the information about cors.