在我看来,我想添加链接,我有:
= link_to 'My Account', edit_user_registration_path( :format => js), :remote => :true
#edit-dialog
我的控制器操作为空。 我的edit.js.erb看起来像:
$("#edit-dialog").dialog({
autoOpen: true,
width: auto,
open: function() {
$("edit-dialog").html(<%= escape_javascript(render('form')) %>")
}
});
当我点击链接时,我将Javascript呈现为新页面中的文本。
$("edit-dialog").dialog({
autoOpen: true,
width: auto,
open: function() {
$("edit-dialog").html(<the partial contents are loaded here>)
}
});
为什么不执行js。相反,它将作为文本返回并呈现为单独的页面。
答案 0 :(得分:0)
原来我在may application.js中没有jquery_ujs。我改为包括:
//= require jquery
//= require jquery_ujs
//= require jquery_ui
它现在有效。