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

android - questions about switching from C2DM to GCM -

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

batch file - How to extract all multi-volume RAR archives from subfolders of a folder? -