$.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.
<head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> </head>
<head> <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.4.1.min.js"></script> </head>
Chill out, job done :).