Reputation: 5104
Let's say I have an index.js.erb file that gets called remotely. How would I render a partial with a collection and then have jQuery display it on the page.
I'm thinking something along the lines of this (that actually works):
$('#eventlist').html("<%= escape_javascript(render :partial => \"memorylist\", :collection => @memories) %>");
Upvotes: 1
Views: 726
Reputation: 9529
Looks good to me. Only thing I might change is using single quotes on the inside to make it a little more readable:
$('#eventlist').html("<%= escape_javascript(render :partial => 'memorylist', :collection => @memories) %>");
Upvotes: 3