Wikipedia project problem with get data from json

Wikipedia project problem with get data from json
0

#1

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


#2

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)


#3

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


#4

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?


#5

Did you use callback=? in the url?


#6

Yes if you mean this
callback=JSON_CALLBACK


#7

Replace JSON_CALLBACK with ?


#8

Thank you very much!!!


#9

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