Wikipedia Viewer: Wikipedia API & Cross-Origin Request Issues

Wikipedia Viewer: Wikipedia API & Cross-Origin Request Issues
0.0 0

#1

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 :slight_smile:


Wikipedia API not showing
Wikipedia project problem with get data from json
#2

Hi. I moved your post to a different category, so it’s more visible :slight_smile:


#3

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.


#4

Glad you found it helpful! :slight_smile:


#5

This is very helpful. Thanks for sharing :slight_smile: -}


#6

Thank you for this! It was really helpful :smiley:


#7

You’re a lifesaver.

(…Clearly I just need to read the whole thing next time…)


#8

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.


#9

Please enjoy watching mine and give me more opinions :blush:


#10

its really helpful. Thanks A lot.
By the way does apply to all error like this one?


#11

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
});


#12

Thanks so much, this helped me so much!


#13

it worked ,thanks :slight_smile:


#14

Hello gcamacho079,

Thanks you so much for your article about the CORS Request Issues you have unblocked me for the Wikipedia Viewer,:smiley:


#15

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.


#16

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.


#17

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


#18

This was the best thing I have seen all day. Thank you so much!


#19

Dude you don’t hijack another persons post with your own issues. You post your own in the relevant section. I actually worked out half your problem, but I’m not going to post any assistance until you do the right thing. If you want my code, message me back here with the link to your posting and I’ll send you what I’ve done so far. Not coming down on you, because we all learn something new each day, but this is a no no, so please don’t do it again and if you are inclined I’d even go so far as to encourage you to delete it once we are done connecting.

PS. Good luck if you’ve moved on already :slight_smile: