在我的Rails 3.2.3应用程序中,我使用的是Ajax和jQuery。网页上有一个链接,我想用一个按钮替换它。下面的代码工作完美Rails - link_to和button_to
<%= link_to "More", {:controller => "home", :action => "test_method", :page=>@current_page }, :remote => true,:id => 'lnk_more' %>
但是这一次不
<%= button_to "More", {:controller => "home", :action => "test_method", :page=>@current_page }, :remote => true,:id => 'lnk_more' %>
结果HTML中的链接和按钮是在这里
#link
<a href="/home/test_method?page=1" data-remote="true" id="lnk_more" disabled="disabled">More </a>
#button
<form action="/home/test_method?page=1" class="button_to" data-remote="true" method="post"><div><input id="lnk_more" type="submit" value="More "><input name="authenticity_token" type="hidden" value="hFCuBR+88FYKEvNTZok+QRhxf6fHA+ucC6i2yc9hBEk="></div></form>
我做了什么错?
这不起作用。 '@ current_page'在哪里? – Alexandre 2012-07-16 16:54:39
参数'id'在哪里? – Alexandre 2012-07-16 17:16:19
@AlexMaslakov,此上下文中的参数是页面 – 2012-07-16 17:25:08