$('body').replaceWith('<%= escape_javascript(render(:partial => 'search_result2', :query => @result_query)) %>');
我想在.html.haml
中使用JavaScript,
$('body').replaceWith('<%= escape_javascript(render(:partial => 'search_result2', :query => @result_query)) %>');
如何更改此行
<%= escape_javascript(render(:partial => 'search_result2', :query => @result_query)) %>
答案 0 :(得分:5)
试试这个
#{ escape_javascript(render(:partial => 'search_result2', :query => @result_query)) }