render js erb code example
Example: render html in js.erb
$('#comments ul.comments').append("<%= j render(:partial => 'comments/foobar') %>");
$('#comments ul.comments').append("<%= j render(:partial => 'comments/foobar') %>");