Ephrino
February 18, 2017, 1:27pm
1
what does this mean?
XMLHttpRequest cannot load https://en.wikipedia.org//w/api.php?action=query&format=json&prop=extracts&…entences=1&exlimit=max&exintro=1&explaintext=1&gsrlimit=10&gsrsearch=space . No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘https://s.codepen.io ’ is therefore not allowed access.
Ephrino
February 18, 2017, 1:33pm
2
and now I noticed that if I click that link here I get this result:
{
warnings: {
main: {
*: “Unrecognized parameters: …entences, gsrlimit, gsrsearch.”
}
},
batchcomplete: “”,
limits: {
extracts: 20
}
}
but if I click the same link from the original source in javascript console it works like is should work
Ephrino
February 18, 2017, 1:41pm
4
that worked! thanks, but what does that actually do? It is not used in the example projects code.
Ephrino
February 18, 2017, 1:54pm
6
ok. well I just tried using the same url as in the example code and that also didn’t work in my pen without that &origin=*
I think the example is using jsonp not json, could this be why the same url work in the example pen but not in my pen?
jenovs
February 18, 2017, 2:02pm
7
You either need to use origin=*
or jsonp.
Read what JSONP is: http://stackoverflow.com/questions/3839966/can-anyone-explain-what-jsonp-is-in-layman-terms
I would recommend to use origin=*