$.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:

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

Or you can use your favourite CDN for super performance.

Google CDN:

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

Microsoft CDN:

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

Chill out, job done :).

You may also like...

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x