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")) %>
精彩评论