如何将此js.erb更改为haml

时间:2013-04-10 09:30:59

标签: javascript jquery ruby ajax

$('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)) %>

1 个答案:

答案 0 :(得分:5)

试试这个

#{ escape_javascript(render(:partial => 'search_result2', :query => @result_query)) }