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

python - argument must be rect style object - Pygame -

c++ - Qt setGeometry: Unable to set geometry -

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