0

我正在尝试基于#381 railscast 剧集运行一个简单的 javascript 文件。但是,当我在我的 javascript 文件中放置警报时,它不会在我加载页面时出现。我确信在查看源代码时文件本身已加载。任何想法为什么它没有加载?

应用程序.js:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require jquery-fileupload/basic
//= require jquery-fileupload/vendor/tmpl
//= require js-routes
//= require twitter/bootstrap
//= requre_self
//= require_tree .

images.js.coffee:

jQuery ->
  alert("hello world")
  $('#new_image').fileupload
    dataType: "script"
4

1 回答 1

2

尝试从 application.js 中删除导致 JS 错误的文件。您也可以尝试删除require_tree .哪些递归包含 app/assets/javascripts 中的所有文件,但如果您这样做,则必须手动添加所有需要包含的文件。

于 2013-01-12T17:36:50.040 回答