Ajax error


#1

I keep getting an Uncaught TypeError: $.ajax is not a function but I'm not sure why. I'm not using the slim jQuery and can't see why I' getting the error.

Does anybody have any suggestions?

This is the code I'm using:

function makeCall(){

		var newId = (new Date()).valueOf();
		var dataLive = {  
			newId: newId,
			ajax: $.ajax({
				data: options,
				dataType: 'json',
				method: 'POST',
				url: thisInstance.url
			}).done(function(data) {
				if ( thisInstance.activeAjaxHandle. newId !== newId ){
					return;
				}
				thisInstance.activeAjaxHandle = {};
				
				callback(data);
				
			})			
		};
		return dataLive;
	}

#2

Because the slim build doesn't include the AJAX module... that's why it's called "slim" (that and no animations and deprecated API). :-)


#3

That's why he's not using the slim jQuery @m3g4p0p :wink:


#4

The code doesn't seem to be causing the problem. We'll need a link to a more complete example for further examination.

It seems that your code doesn't have jQuery available, as a cause of the problem.


#5

Thank you, if you go here and on the left try checking the filters on the left


#6

Hey @coding_noobie

So, it turns out that @m3g4p0p was pretty spot on - looking through the HTML for your page, you're loading jQuery 2.2.4 and some plugins from the jsdelivr CDN. Then, in the footer of the page, you're loading jQuery 3.2.1 Slim from the jQuery CDN.. this second version will be replacing the first and knocking out the ajax stuff (among other things).


#7

Thank you, I hadn't realised that was there. I think when I first starting to use Bootstrap I must have added it but as it got more advanced I added the other jQuery.

Thanks


#8

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.