Reputation: 187
I Have a rendering of a partial that should be outputted to a div that is not displayed 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 are all outputing the same following thing:
If I remove the escape_javascript, it ain't working anymore.
Upvotes: 3
Views: 3228
Reputation: 187
Thanks to Emu who posted the answer in ERB I found a way of doing it in haml:
:plain
$('.modal-body').html('#{j render partial: 'details'}'); // in HAML
$('.modal-body').html('<%= j render partial: 'details'%>'); //in ERB
Upvotes: 1
Reputation: 5895
$('.modal-body').html('<%=j render partial: 'details' %>'); // in HTML
$('.modal-body').html('#{j render partial: 'details'}'); // in HAML
Upvotes: 1