← Back to Upcase

$.ajaxPrefilter uncaught TypeError: undefined is not a function


(Dean Richardson) #1

I’m trying to use Foundation 5’s javascript in my rails app and so far none of the functionality (dropdowns, orbit slider) is working.

In my developer tools console, I see the following Javascript error:

uncaught TypeError: undefined is not a function. The reference is to application.js?body=1:310.

Line 310 in my application.js says:

$.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});

A redboxed error message shows up directly under this line when I examine the code in the console.

I have

gem 'jquery-rails', '3.1.0'

in my gemfile.

In my application.js, I have the following:

//= require jquery
//= require jquery_ujs
//= require foundation
//= require_tree .

$(function(){
	$(document).foundation();
});

I’m not loading any jquery via the googleapis cdn.

Any ideas what I might be doing wrong here? I’d be very grateful for suggestions or further questions about my setup.

Thanks!

Dean Richardson