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:
- putting the script portion in the Javascript section and removing the script tags
- modifying the API URL to https://www.freecodecamp.com/json/cats.json
- adding http://crossorigin.me/ to the beginning of the URL
- adding Jquery as external javascript in settings
Any ideas? Here’s a Codepen that explains my current situation:
https://codepen.io/amcgladd/pen/MvQKPw
Thanks!