Display html from javascript rails
I have a rendering of a partial that needs to be output to a div that is not displaying correctly. I tried in my index.js.haml:
= "$('.modal-body').html('#{escape_javascript(raw render("details"))}');"
= "$('.modal-body').html('#{escape_javascript(raw render("details")).html_safe}');"
= "$('.modal-body').html('#{escape_javascript(raw render("details").html_safe)}');"
= "$('.modal-body').html('#{raw escape_javascript(raw render("details"))}');"
= "$('.modal-body').html('#{raw escape_javascript(raw render("details").html_safe)}');"
= "$('.modal-body').html('#{raw escape_javascript(raw render("details")).html_safe}');"
and they all output the following:
If I remove escape_javascript it doesn't work anymore.
+3
source to share
2 answers