render html from javascript rails -
i have rendering of partial should outputted div not displayed correctly. tried in 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 outputing same following thing:
if remove escape_javascript, ain't working anymore.
thanks emu posted answer in erb found way of doing in haml:
:plain $('.modal-body').html('#{j render partial: 'details'}'); // in haml $('.modal-body').html('<%= j render partial: 'details'%>'); //in erb
Comments
Post a Comment