Jquery 如何在rails中动态更改模式对话框标题?

Jquery 如何在rails中动态更改模式对话框标题?,jquery,ruby-on-rails,Jquery,Ruby On Rails,我想根据数据库值更改模式对话框标题。下面是加载模态对话框的代码 page.replace_html 'show_event', :partial => 'show_event' page<< "$j ('#show_event_dialog').dialog({ title: '', modal: true, width: 500, close: function(event, ui) { $j ('#show_event_dialog').d

我想根据数据库值更改模式对话框标题。下面是加载模态对话框的代码

page.replace_html 'show_event', :partial => 'show_event'

page<< "$j ('#show_event_dialog').dialog({
    title: '',
    modal: true,
    width: 500,
    close: function(event, ui) { $j ('#show_event_dialog').dialog('destroy') }

}); "

我通过链接传递事件id,现在我想将标题更改为事件名称。但是如何将数据库valueevent.name检索到此js.rjs文件中?有人能帮我吗

我不太了解RJ,但是控制器操作中定义的每个实例变量都应该可用于渲染器。尝试在控制器操作中查找@事件,然后使用字符串插值:

page<< "$j ('#show_event_dialog').dialog({
    title: '#{@event.name}',
    modal: true,
    width: 500,
    close: function(event, ui) { $j ('#show_event_dialog').dialog('destroy') }