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

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

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -