I know this is an old thread but if people are still having trouble with this API, I wrote an article about solving this issue using CORS instead of JSONP Wikipedia Viewer: Wikipedia API & Cross-Origin Request Issues
Hi. I moved your post to a different category, so it’s more visible
Thanks. This article was so helpful. I read many other article and either they didn’t mention the" origin=*" or I am skimmed by it.
Glad you found it helpful!
This is very helpful. Thanks for sharing -}
Thank you for this! It was really helpful
You’re a lifesaver.
(…Clearly I just need to read the whole thing next time…)
Thanks, I was lost with this challenge, I thought it would be like the weather app, but the I get stuck. Your article was really helpfull.
Please enjoy watching mine and give me more opinions
its really helpful. Thanks A lot.
By the way does apply to all error like this one?
hello
i hope you will read that but i do everything you wrote
same api and same parameters and this return string to me
so
$.ajax({type:“GET”,
datatype:“Json”,
data:{origin:"*"},
success:function({}):
i use inside function
alert (typeof(json)) and show string not object at all
why that
});
Thanks so much, this helped me so much!
it worked ,thanks
Hello gcamacho079,
Thanks you so much for your article about the CORS Request Issues you have unblocked me for the Wikipedia Viewer,
This was a great help, thank you.
I still had trouble after this, because my button was a submit type. I removed that, and everything worked.
Thank You VERY much! I read a lot about CORS, everything look fine but - nothing worked. That was button type. I would never come to this by myself.
Not working for me…
https://wikipedia.org/w/api.php?action=query&format=json&prop=extracts&list=&continue=&titles=&generator=search&callback=&formatversion=1&exsentences=3&exintro=1&explaintext=1&exsectionformat=plain&gsrsearch=javascript&origin=*
I have my &origin=*
set, but still getting
Failed to load https://wikipedia.org/w/api.php?action=query&format=json&prop=extracts&list=&continue=&titles=&generator=search&callback=&formatversion=1&exsentences=3&exintro=1&explaintext=1&exsectionformat=plain&gsrsearch=json&origin=*: Redirect from 'https://wikipedia.org/w/api.php?action=query&format=json&prop=extracts&list=&continue=&titles=&generator=search&callback=&formatversion=1&exsentences=3&exintro=1&explaintext=1&exsectionformat=plain&gsrsearch=json&origin=*' to 'https://www.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&list=&continue=&titles=&generator=search&callback=&formatversion=1&exsentences=3&exintro=1&explaintext=1&exsectionformat=plain&gsrsearch=json&origin=*' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Here it is:
[FCC] Wikipedia Viewer
This was the best thing I have seen all day. Thank you so much!