Rails 3:remote => true不会触发AJAX请求

Eng*_*epe 7 ajax ruby-on-rails-3

我有以下内容:

<%= link_to "Exhibitions", :action => 'tabExhibitions', :id => @app.id, :remote => true %>
Run Code Online (Sandbox Code Playgroud)

它产生:

<div class="tabbarButton" id="tabbarExhibitions">
    <a href="/apps/3/tabExhibitions?remote=true">Exhibitions</a>
</div>
Run Code Online (Sandbox Code Playgroud)

单击时会导致共同的GET请求.

我是Rails的新手但我的理解是设置:remote => true应该创建一个<a href="..." data-remote=true>而不是一个普通的链接.

我正在使用jQuery,必要的标头和元标签已经到位.我应该提到这个项目是从Rails 2.3.8升级而来的

谢谢你的帮助.

Mic*_*ley 10

link_to放入参数列表:remote => trueurl一部分,并为其创建一个查询字符串参数(请参阅文档中的参数).基本上,你写的是:

<%= link_to "Exhibitions", { :action => 'tabExhibitions', :id => @app.id, :remote => true } %>
Run Code Online (Sandbox Code Playgroud)

你会想要一个单独的哈希html_options:

<%= link_to "Exhibitions", { :action => 'tabExhibitions', :id => @app.id }, :remote => true %>
Run Code Online (Sandbox Code Playgroud)