我从controller.now调用一个js函数,我将那些js代码移到js.erb文件中。如何在page.call文件中使用js.erb?代码:
page.call "replace_rentroll_class"
page.call "flash_writter", "#{FLASH_MESSAGES['properties']['412']}"
how to move those codes into js.erb file?发布于 2013-11-19 13:47:39
您只需直接调用javascript函数,es:
page.call "function1", "param1", "param2"应该变成
function1("param1", "param2");就你而言:
replace_rentroll_class();
flash_writter("<%=j FLASH_MESSAGES['properties']['412'] %>")j的存在是为了防止Rails在消息中转义HTML标记。如果你不需要的话就把它拿掉。
https://stackoverflow.com/questions/20072961
复制相似问题