link_to_remote在rails上的ruby中不起作用

时间:2013-10-15 18:50:28

标签: jquery ruby-on-rails ruby

我正在使用link_to_remote逐个回答测验。在那我想要检查单选按钮。但是当我点击按钮然后单击它然后它没有改变时,微调器只加载

<div class = "y">
<% form_for @answer do |f|%>
<div class = "label_field_pair">
<label for "questions">
  <%= @ans.ques %>
</label>  
</div> <br>
<div class = "label_field_pair2">
<label for "options">
  <div id = "option-1">
    <%= radio_button_tag :answer, :ans1%><%= @ans.ans1 %>
  </div><br>
  <div id = "option-2">
    <%= radio_button_tag :answer, :ans2%><%= @ans.ans2 %>
  </div><br>
  <div id = "option-3">
    <%= radio_button_tag :answer, :ans3%><%= @ans.ans3 %>
  </div><br>
  <div id = "option-4">
    <%= radio_button_tag :answer, :ans4%><%= @ans.ans4  %>
  </div><br>
</label>
</div>
  <%= link_to_remote "Next", 
    :before => "Element.show('loader')",
    :success => "Element.hide('loader')",
    :url=>{:controller=>"answers", :action=>"next"},
    :with => "'answer='+$F(answer)+'&passed_question=#{@ans.id}&'+'&exam_group_id=#{@exam_group.id}&'"
  %> 
</div> 
<% end %> 
</div> 

因为我想获得选中单选按钮的值:with statement ... 在此先感谢请帮帮我

1 个答案:

答案 0 :(得分:0)

你应该做

<%= link_to "Next", your_path, :remote => true, ... %>