I literally copy and pasted the earlier exercise to see if the JSON was working properly for JQuery. I already enabled JQuery and everything but it is still refusing to work like it did in the exercise can someone please explain because I am beyond lost and need to get this to work so I can apply this same logic to my random quote machine.
Here is the thing:
You need a real URL for which to get a JSON… /json/cats is not a URL… that example is only valid on free code camp site because the image is stored there… you can not access it outside Fre code camp unless you have the URL from the image
Just expanding on what @Docwali777 stated above.
If this is your first time making ajax calls here is a overview of what an ajax/getJSON call is trying to do.
-https:// | https://forum.freecodecamp.com | /t/my-json-is-not-working/91528
protocol | ------ host---------------------------| --------------path---------------------
This is saying using http go find the host and retrieve the resources located at this path. So the reason the url “/json/cats.json” worked when you were doing the exercise is because you were on a different host www.freecodecamp.com. The reason the url “/json/cats.json” doesn’t work now is because you are asking codepen.io for “/json/cats.json” which it does’nt own. Wikipedia page for url
TL;DR You will need to find a quote api to use. Then replace your current url with the url endpoint given to you by the api you choose.
Spoiler Alert: Happy Coder explains how to use an api to do this project.