简体   繁体   中英

jquery stopped working, on mine rails app, after adding mercury gem

The error a resive is: TypeError: jQuery.browser is undefined

In my aplication.js file a have

   //= require jquery
   //= require jquery_ujs
   //= require mercury
   //= require_self

my gem file looks like

gem 'rails', '3.2.12'
ruby "1.9.3"

gem 'pg'

group :assets do
  gem 'sass-rails'
end


gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'devise'
gem "paperclip"
gem 'uglifier'
gem 'coffee-rails'
gem "haml"
gem 'mercury-rails'

group :development do
    gem 'better_errors'
    gem 'binding_of_caller'
    gem 'meta_request'
end

and in my mercury.html.erb

<%= stylesheet_link_tag    'mercury' %>
<%= javascript_include_tag 'jquery-1.7', 'mercury' %>

I have the same problem now, even after removing //=require mercury from aplicarion.js

$.browser is undefined error

It appears that your version of jQuery is too new. jQuery.browser is no longer supported. Also the reason the problem persists even after you remove the "//=require mercury" line is because you need to restart your server for the asset pipeline to do its stuff.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM