I need to render view template by jQuery. I have template 'category.html.erb' and file 'category.js.erb' with following code:
$("#block").html("<%= escape_javascript(render :template => 'category') %>");
but it doesn't render 开发者_如何学编程category view template.
Please help me!
Try $("#block").html("<%= escape_javascript(render(:template => 'category')) %>");
I prefer rendering a partial like: $("#block").html("<%= escape_javascript(render(:partial => 'category')) %>");
精彩评论