$.ajax is not a function

TL;DR; Make sure you've loaded jQuery into your page.

You’re ripping your hair out. “Why won’t it work?”. You’ve already subsituted that infernal cURL request that didn’t work and now ajax isn’t working!

Don’t panic – the $.ajax(…) is not a function error is more common than you might think.

And thankfully the solution is usually pretty quick.

Have you stopped and checked that you’ve loaded jQuery onto your page?

Pro tip: remember to use the minified version on live sites.  

You can host it on your server:

<script src="jquery-3.4.1.min.js"></script>

Or you can use your favourite CDN for super performance.

Google CDN:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

Microsoft CDN:

<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.4.1.min.js"></script>

Chill out, job done :).

You may also like...

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x
%d bloggers like this: