I have the following:
我有以下内容:
<%= link_to "Exhibitions", :action => 'tabExhibitions', :id => @app.id, :remote => true %>
It generates:
它产生:
<div class="tabbarButton" id="tabbarExhibitions">
<a href="/apps/3/tabExhibitions?remote=true">Exhibitions</a>
</div>
Which results in a common GET request when clicked.
单击时会导致共同的GET请求。
I am new to Rails but my understanding was that setting :remote => true
should have created a <a href="..." data-remote=true>
instead of a plain link.
我是Rails的新手,但我的理解是设置:remote => true应该创建一个而不是一个普通的链接。
I am using jQuery, the necessary headers and meta tags are in place. I should mention this project was upgraded from Rails 2.3.8
我正在使用jQuery,必要的标头和元标签已经到位。我应该提到这个项目是从Rails 2.3.8升级而来的
Thanks for all the help.
谢谢你的帮助。
1 个解决方案
#1
10
link_to
is putting :remote => true
into the url
portion of the argument list, and creating a query-string parameter for it (see the parameters in the documentation). Essentially, what you've written is:
link_to将:remote => true放入参数列表的url部分,并为其创建查询字符串参数(请参阅文档中的参数)。基本上,你写的是:
<%= link_to "Exhibitions", { :action => 'tabExhibitions', :id => @app.id, :remote => true } %>
You'll want to have a separate Hash for the html_options
:
你想要为html_options设一个单独的Hash:
<%= link_to "Exhibitions", { :action => 'tabExhibitions', :id => @app.id }, :remote => true %>
#1
10
link_to
is putting :remote => true
into the url
portion of the argument list, and creating a query-string parameter for it (see the parameters in the documentation). Essentially, what you've written is:
link_to将:remote => true放入参数列表的url部分,并为其创建查询字符串参数(请参阅文档中的参数)。基本上,你写的是:
<%= link_to "Exhibitions", { :action => 'tabExhibitions', :id => @app.id, :remote => true } %>
You'll want to have a separate Hash for the html_options
:
你想要为html_options设一个单独的Hash:
<%= link_to "Exhibitions", { :action => 'tabExhibitions', :id => @app.id }, :remote => true %>