2011-08-01 57 views
0

我正在嘗試做一些分頁ajax,但我canno獲取index.js.erb加載或以任何方式被識別。我遵循railscast 240:https://github.com/ryanb/railscasts-episodes/blob/master/episode-240/store/app/views/products/_products.html.erbrails index.js.erb not loading

我正在使用下面的代碼:

index.js.erb的

$("#products").html("<%= escape_javascript(render("products")) %>");

請求似乎經歷正常,但不支持HTML代碼加載。沒有什麼變化(雖然沒有錯誤)

+0

檢查你的報價 –

+2

加布裏埃爾,報價很好。 Rails處理<%= and %>之間的代碼。 –

回答

1

這是因爲我在我的控制器不format.js有format |do|。對不起大家!

0

嘗試使用:的

<%= escape_javascript(render(:partial => 'products/products')) %> 

代替

<%= escape_javascript(render("products")) %>