$.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