开发者

rails index.js.erb not loading

开发者 https://www.devze.com 2023-03-25 01:46 出处:网络
I am attempting to do some ajax for pagination but I canno get index.js.erb to load or开发者_运维百科 be recognized in any way. I\'m following railscast 240:https://github.com/ryanb/railscasts-episode

I am attempting to do some ajax for pagination but I canno get index.js.erb to load or开发者_运维百科 be recognized in any way. I'm following railscast 240:https://github.com/ryanb/railscasts-episodes/blob/master/episode-240/store/app/views/products/_products.html.erb

I am using the code below:

index.js.erb

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

The request seems to go through properly, but the HTML isn't loading. Nothing changes (no errors though)


It was because I had format |do| in my controller without format.js. Sorry guys!


Try using:

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

instead of

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

精彩评论

暂无评论...
验证码 换一张
取 消