我有这个命令,我知道它在语法上有点偏离
page << "$('.places').append('<%= escape_javascript(render(:partial => 'contact', :locals => {:contact => @contact, :something => @something, :checked => false, :sale => @sale.item.to_s})) %>');"
这是我需要进行的基本调用,但我知道js.rjs文件的语法是错误的。。。。有没有办法将其转换为格式
使用原型(Rails 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(Rails3)
$(".places").append("<%= escape_javascript render 'contact', :locals => {:contact => @contact, :something => @something, :checked => false, :sale => @sale.item.to_s} %>");