开发者

Render partial with collection with jQuery

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):

开发者_StackOverflow$('#eventlist').html("<%= escape_javascript(render :partial => \"memorylist\", :collection => @memories) %>");


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) %>");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜