Help with Random quote machine, $.ajax is not a function


hey guys, I’ve been 2 days with this challenge but I’m stuck, it shows me this error:
Uncaught TypeError: $.ajax is not a function
I don’t know what else I should do, this my code:

type: 'GET',
url: '',
success: function(data){

I hope you guys may help me, cheers.


Are you sure you have added jQuery in your project? Maybe you can share your codepen if you have one.


It looks like you have jQuery added, otherwise it would have thrown an error at the first instance of “$”. Is that the only error that comes up? I do notice a syntax error though in the console log. You’ve added a period when it looks like you meant to have added a colon. Also it needs to be inside of the string.


This is my codepen and it’s the only error that shows.


It looks like .ajax is not included in the slim version of jQuery. Try again with the full version:

Then you’ll see this warning in the console:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)

You’ll probably have to use a proxy to deal with this, or use a different API (this works btw:


@kevcomedia thanks for your help, it was the jQuery version, But why I must use a proxy? why don’t it work without it?


If I understood it correctly, it’s because the JSON response is coming from a different domain (which is not allowed by default). If the response has Access-Control-Allow-Origin set to * in its header, you can use the URL as it is.

Someone wrote a detailed explanation in the forum long ago: