2013-04-10 53 views
3
$('body').replaceWith('<%= escape_javascript(render(:partial => 'search_result2', :query => @result_query)) %>'); 

我想.html.haml使用JavaScript使用它,如何改變這種js.erb到HAML

$('body').replaceWith('<%= escape_javascript(render(:partial => 'search_result2', :query => @result_query)) %>'); 

如何改變這一行

<%= escape_javascript(render(:partial => 'search_result2', :query => @result_query)) %> 

回答

5

試試這個

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

!GOOD very helpful – linzilan 2013-04-10 09:43:19

+0

@Paul Fioravanti Yes ... !! i t的正確和非常有用的..但我沒有足夠的聲望現在投票....... :( – linzilan 2013-04-10 11:05:24