部署到Site5后jQuery不工作

部署到Site5后jQuery不工作,jquery,ruby-on-rails,ruby,ruby-on-rails-3,ruby-1.8.7,Jquery,Ruby On Rails,Ruby,Ruby On Rails 3,Ruby 1.8.7,我成功地将我的应用程序部署到了Site5——当我开始在上面玩的时候,我意识到并不是所有的jQuery都能工作。具体来说,任何涉及从Ruby表单获取信息的内容。我得到以下错误: Uncaught TypeError: Object [object Object] has no method 'live' Uncaught TypeError: Object [object Object] has no method 'live' (anonymous function) (anonymous f

我成功地将我的应用程序部署到了Site5——当我开始在上面玩的时候,我意识到并不是所有的jQuery都能工作。具体来说,任何涉及从Ruby表单获取信息的内容。我得到以下错误:

Uncaught TypeError: Object [object Object] has no method 'live' 
Uncaught TypeError: Object [object Object] has no method 'live'
(anonymous function)
(anonymous function) 
ut.extend.globalEval 
ut.fn.extend.domManip 
ut.fn.extend.replaceWith 
(anonymous function) 
ut.event.dispatch 
y.handle 
脚本如下所示,并且在本地、heroku和hostmonster上工作,所以我不明白为什么它现在不工作。 文件中:

<%= form_for :team_design, :url => {:controller => "team_designs", :action => 'create'} do |f| %>

    <%= f.label :style %>   <%= f.select :style, [["Mens", "Mens"], ["Womens", "Womens"]], :include_blank=>'Select Style' %>
在Application.js中:

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require_tree .
在我的布局文件中

<head>
  <title>scrubbed</title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
在Google Chrome的Sources下:

/*!
 * jQuery JavaScript Library v1.9.1
 * http://jquery.com/
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 *
 * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2013-2-4
 */
 * Sizzle CSS Selector Engine
 * Copyright 2012 jQuery Foundation and other contributors
 * Released under the MIT license
 * http://sizzlejs.com/
 */
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
检查是否:

  • gemjqueryrails包含在gemfile中的资产组中
  • jquery包含在javascript清单文件中
  • 您在部署期间编译了资产
来自:

.live(事件、处理程序(eventObject))返回:jQuery
已弃用版本:1.7,已删除版本:1.9
[…]
从jQuery 1.7开始,
.live()
方法已被弃用。使用
.on()
附加事件处理程序。较旧版本的jQuery用户应优先使用
.delegate()
,而不是
.live()

因此,
live
早在1.7版(2011年11月)就被弃用,并在1.9版中被完全删除。您使用的是jquery1.9.1,因此不再有
live
。既然您说它在某些地方有效,但在其他地方无效,那么您必须混合jQuery版本,这只是痛苦和痛苦的捷径,所以不要混合版本

更新jQuery代码以使用,而不是
live
delegate
。和文档向您展示了如何将
live
delegate
转换为
on


您应该开始关注发行说明并更新您的代码:不要等到功能被删除,只要有不推荐的内容,就更新您的代码

您需要发布所有标记。如果数量很多,就把它放在一个粘贴箱中。你使用的是什么版本的jQuery,从哪里获得它?@muistooshort我使用的是v。1.9.1在jQuery.com中,jQuery rails gem未包含在资产项下——我尝试运行bundle instal将其移动到那里,并对资产进行预编译,但这没有改变任何东西。在我的application.js中,我有所有的//=require语句,并且我使用rakeassets:precompile预编译资产。我相信,如果不让我知道的话,我会满足这些
group :assets do
  gem 'execjs'
  gem 'therubyracer', :platforms => :ruby
  gem 'johnson'
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby
  gem 'jquery-rails'
  gem 'uglifier', '>= 1.0.3'
end
/*!
 * jQuery JavaScript Library v1.9.1
 * http://jquery.com/
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 *
 * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2013-2-4
 */
 * Sizzle CSS Selector Engine
 * Copyright 2012 jQuery Foundation and other contributors
 * Released under the MIT license
 * http://sizzlejs.com/
 */
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */