我有一个选择框,每次更改时我都会回到控制器并获取一些数据。然后将该数据加载到div中。
jQuery的:
$('#groups').change(function() {
$('#emails').load('/notifications/get', {value: $(this).val()});
});
控制器:
class NotificationsController < ApplicationController
def get
return "test"
end
end
查看:
<div id="groups" class="left">
<%=select_tag 'employee[group_id][]', options_for_select( current_user.groups.map {|s| ["#{s.name} - #{s.description} (" + s.employees.find(:all, :conditions=>{:subscribed=>true}).count.to_s+")", s.id]}), :multiple => true, :size =>6, :style => "width:250px"%>
</div>
<p id="emails"> </p>
当我尝试使用firebug进行调试时,我发现该错误为405 method not allowed
..还有更多回复说明
Only get, put, and delete requests are allowed.
答案 0 :(得分:1)
您是否为该操作设置了路线?