cleft cleft - 3 months ago 14
Javascript Question

Ajax not working - keep getting $.ajax is not a function error

No matter what I do I keep getting the same error "

is not a function" and I can't seem to figure it out.

I have been working on this for a while and this is what I have tried.

My Debugging / Troubleshooting Steps -
(I am laying this out so it will be a resource to help easily resolve more common problems.)

1. jQuery is installed.

Ran the following test:

$(document).ready(function() {
alert('pre test success');
if(window.jQuery) {
alert('post test success');
} else {
alert('test fail Jquery did not load!');

2. Tested current and previous versions of jQuery (I am NOT using slim release).

(Note: it appears the slim version does not include Ajax)

I have even tried to include Ajax library completely seperate along with jQuery library using jQuery Builder at

3. Tested many different syntax to help eliminate syntax error.

For example from answer to similar question on stack overflow:

type: 'POST',
url: url,
data: myData,
dataType: 'json',
success: callback

Even this one directly from the jquery home page:

url: "/api/getWeather",
data: {
zipcode: 97201
success: function( result ) {
$( "#weather-temp" ).html( "<strong>" + result + "</strong> degrees");

I have also tried to change
etc with no luck.

4. Confirm I am using document ready

See code for #1
alert('pre test success');

5. Confirm jQuery library is included before script with Ajax.


It seems no matter what I do nothing solves this problem. And for the what it' worth I am running this on XAMP and DigitalOcean server and getting the same results.

Any suggestions?

Answer Source

maybe are you using other libraries which could mess up with the use of the $ sign ?

Have a look there : Avoiding Conflicts with Other Libraries (jQuery)