Need help in Wikipedia Viewer

Need help in Wikipedia Viewer
0

#1

Hello!
I am not getting JSON data from wikipedia API. I am using get() function.
This the code: https://codepen.io/karanatwal/pen/EvoXmz


#2

Add origin=* to handle CORS in your wikipedia api url to fix your immediate problem - use devtools console to see the error message in the first place

"https://en.wikipedia.org/w/api.php?action=query&origin=*&titles=Main Page"

Add format=json&formatversion=2&utf8 to get JSON instead of HTML - UTF-8 is for proper handling of characters from non-English languages

"https://en.wikipedia.org/w/api.php?action=query&origin=*&format=json&formatversion=2&utf8&titles=Main Page"

chrome devtools console is essential to learning and using javascript


Unable to fetch data from mediawiki api using XMLHttpRequest