我想一些代码,会自动重新加载的帖子,并将其插入到DIV post_container:Rails的AJAX加载整个页面为“更新” DIV
<%= link_to_remote "Update", {:action => 'ajax_update', :id => @posts, :update => 'post_container'}, :confirm => "Are you sure?" %>
这轨在我home.html.erb片断,其实需要整个页面(标题,头部,主体标签)并将其放在div post_container中。为什么?另外,据我所知,ajax_update函数甚至不会被调用。
我该怎么做我想做的事?为什么整个页面加载都会发生?我使用Rails 2.3.11
(编辑:也没有,当你点击链接确认对话框。)
编辑2:
<a confirm="Are you sure?" href="#" onclick="new Ajax.Updater('post_container', '/home', {asynchronous:true, evalScripts:true, parameters:'authenticity_token=' + encodeURIComponent('uaqM0Ie8to5pprvE6WcF416DN0vNeyO7Xa+JM6VZFY4=')}); return false;">Update</a>
: 代码段的HTML输出
加入':remote => true'? – uday 2012-03-17 03:22:00