[JQUERY][AJAX] Undefined error driving me crazy

Hello everyone ! I was working on the wikipedia viewer but I couldn’t get to the end of it : I don’t know why, but the AJAX request doesn’t seem to give me anything, and I can’t hugging figure out why !

I made some research and figured it could be a CORS error, but then again, why would it be ?? Since I can without any problem use the wikipedia viewer of other campers, that are allegedly using the same api. So, I made a codepen to isolate the error : https://codepen.io/Hadrienallemon/pen/EQRxBP

could someone please help me ? Because it’s making me nuts not beeing able to figure what the hell is hapening.

Thanks a lot !

Hi hadrienallemon,

Adding an origin="*" parameter to your request will solve the CORS issue. You can add it to the url or use the data option in your ajax config:

data: {origin: "*"}

Here are the details: https://www.mediawiki.org/wiki/API:Cross-site_requests

Hope this helps!

Thank you so much ! <3