Wikipedia project problem with get data from json

Could anyone give me some help please! I am taking users request and I have the url with the JSON and I can not take the data from there! I have read almost everything and still nothing!
Here is my project so far

try callback=?

For some reason alert doesn’t work on codepen anymore. Use console.log(JSON.stringify(data)) instead (if objects are too big, they won’t print on codepen’s console, so wrap first with JSON.stringify)

I didn’t know about alert. With console.log(JSON.stringify(data)) still nothing

Debugger gives me this:
Cross-Origin
Request Blocked: The Same Origin Policy disallows reading the remote
resource at
https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=swan%20lake&callback=JSON_CALLBACK.
(Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Maybe cannot use https here?

Did you use callback=? in the url?

1 Like

Yes if you mean this
callback=JSON_CALLBACK

Replace JSON_CALLBACK with ?

1 Like

Thank you very much!!!

A post was split to a new topic: Wikipedia Viewer: Wikipedia API & Cross-Origin Request Issues