除了$.getScript("/comments.js
部分外,一切似乎都正常。我试图解决它,但没有运气。
我有我的application.js
文件,该文件有:
$(function() {
setTimeout(test, 1000);
});
function test() {
$.getScript("/comments.js")
setTimeout(test, 1000);
}
$.getScript("/comments.js", function(){
updateComments();
});
和我的意见index.js.erb的/评论
function updateComments(){
alert("testing");
}
我的意见控制器
def index
# ...
end
布局/ application.html.erb
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
我只是想看看我能不能让它工作,但它什么都不做。
您是否在使用资产管道?,在这种情况下,我认为是路由问题 – eveevans 2012-02-07 20:27:24