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.
Do you have a route set for that action?
精彩评论