2012-02-12 42 views
0

我有這樣的命令,我知道是有點過了語法我如何將這添加到rjs?

page << "$('.places').append('<%= escape_javascript(render(:partial => 'contact', :locals => {:contact => @contact, :something => @something, :checked => false, :sale => @sale.item.to_s})) %>');"  

這是基本的通話,我需要做,但我知道的語法是錯誤的js.rjs文件....有的方式將其轉換到格式

+0

您正在使用哪種版本的導軌? – inkdeep 2012-02-13 22:11:10

回答

1

使用原型(滑軌2.3)

page.select(".places").each do |element, index| 
    page.insert_html :bottom, element, :partial => 'contact', :locals => {:contact => @contact, :something => @something, :checked => false, :sale => @sale.item.to_s} 
end 

使用jQuery(導軌3)

$(".places").append("<%= escape_javascript render 'contact', :locals => {:contact => @contact, :something => @something, :checked => false, :sale => @sale.item.to_s} %>"); 
相關問題