Escaping String in Rails's JS Output

Submitted by swarut on Tue, 07/03/2012 - 15:12

This can be done using escape_javascript method (aliased with j() ).

  1. $(".comments").html("<%= escape_javascript(@comment.discussion.nested_comments) %>");