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:

enter image description here

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

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -