0
我有問題獲取響應腳本在客戶端上運行。我對軌道很陌生,我不確定遙控器的真實性。我有以下鏈接:Rails:js.erb不會在客戶端執行?
<%= link_to "#{p.title}", post_path(p), remote: true %>
當我點擊它,它引導到表演動作這使得文章的內容,我想分析的內容,以一個div。我show.js.erb看起來像這樣
$("#content").html("<h2><%= @post.title %> </h2><p><%= @post.body %></p>");
,當我點擊鏈接,我得到這個響應。
Started GET "/posts/14" for 127.0.0.1 at 2014-01-28 10:51:12 -0800
Processing by PostsController#show as JS
Parameters: {"id"=>"14"}
Post Load (0.2ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", "14"]]
Rendered posts/show.js.erb (0.2ms)
我得到整個jQuery代碼看着http響應,但不知何故它不會被執行。
是否存在與網頁上的ID'content'標籤? – jason328