Rails 405 方法不允许
我有一个选择框,每次更改时我都会返回控制器并获取一些数据。然后将该数据加载到 div 中。
jQuery:
$('#groups').change(function() {
$('#emails').load('/notifications/get', {value: $(this).val()});
});
Controller:
class NotificationsController < ApplicationController
def get
return "test"
end
end
View:
<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
..进一步返回的响应说
仅获取、放置和删除 允许请求。
I have a select box and on every change I am going back to my controller and fetching some data. This data is then loaded into a div.
jQuery:
$('#groups').change(function() {
$('#emails').load('/notifications/get', {value: $(this).val()});
});
Controller:
class NotificationsController < ApplicationController
def get
return "test"
end
end
View:
<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>
When I try to debug with firebug I see that error is 405 method not allowed
..furthermore response that comes back says
Only get, put, and delete requests are allowed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否为该操作设置了路线?
Do you have a route set for that action?