Ruby on rails Rails AJAX将整个页面加载到';更新';div

Ruby on rails Rails AJAX将整个页面加载到';更新';div,ruby-on-rails,ajax,Ruby On Rails,Ajax,我想要一些自动重新加载帖子并将其插入div post_容器的代码: <%= link_to_remote "Update", {:action => 'ajax_update', :id => @posts, :update => 'post_container'}, :confirm => "Are you sure?" %> 'ajax\u update',:id=>@posts,:update=>'post\u container'},:confirm

我想要一些自动重新加载帖子并将其插入div post_容器的代码:

<%= link_to_remote "Update", {:action => 'ajax_update', :id => @posts, :update => 'post_container'}, :confirm => "Are you sure?" %>
'ajax\u update',:id=>@posts,:update=>'post\u container'},:confirm=>“你确定吗?”%>
my home.html.erb中的这个rails片段实际上占据了整个页面(title、head、body标记),并将其放置在div post_容器中。为什么?而且,据我所知,ajax_更新函数甚至没有被调用

我该怎么做我想做的事?为什么要加载整个页面?我使用的是Rails 2.3.11

(编辑:此外,单击链接时没有确认对话框。)

编辑2: 代码段的html输出:

<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>

在控制器操作中,使用:layout=>false

def ajax_update
  @posts = Post.find(@posts)
  render :layout => false
end

找到了正确的方法:

<%= link_to_remote "Update",:update => 'post_container', :url => {:action => 'ajax_update', :id => @posts, }, :confirm => "Are you sure?" %>
'post\u container',:url=>{:action=>'ajax\u update',:id=>@posts,},:confirm=>“您确定吗?”%>
根据Rails 2.3.11 API文档中的信息:


此外,该页面上的定期调用远程方法对于不需要单击的自动调用也很有用。

该操作似乎从未真正被调用过。如果您想再看一看,我已经在问题中添加了html输出