I’d like to play around with the code from the FCC lessons for JSON APIs and AJAX on Codepen. However, the code doesn’t behave the same when placed in Codepen. In particular, when clicking the “Get Message” button, nothing happens on Codepen.
Could someone explain to me why the code on FCC lessons for JSON APIs and AJAX, in particular the lessons which incorporate calls to an API, don’t work on Codepen? So far I’ve tried:
- modifying the API URL to https://www.freecodecamp.com/json/cats.json
- adding http://crossorigin.me/ to the beginning of the URL
Any ideas? Here’s a Codepen that explains my current situation: