Why would my AJAX request not work in Codepen.io?


I wasn’t able to make my AJAX request work for the first d3.js project so far, so I decided to test whether if I copy some assignment that I already solved on FCC platform, replace a link with a full link to FCC (https://www.freecodecamp.org/json/cats.json) for the Cat Photo Finder and test whether the it will do anything once I press ‘get message’ button. However, nothing happens when I press on the corresponding button.

Here is my Codepen project for that: Cat Photo Finder Pen

What am I doing wrong here? Is there anything I would need to change in Codepen settings or import any statements to make it work?

its a syntax error. remove the closing ‘)’ on line 17

So the issue here was basically that the request has been blocked by CORS policy. Therefore it didn’t work for testing on Codepen.