【问题标题】:Rails 405 Method not allowedRails 405 方法不允许
【发布时间】:2011-04-03 11:16:44
【问题描述】:

我有一个选择框,每次更改时我都会返回我的控制器并获取一些数据。然后将此数据加载到 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 ..furthermore 回复说

仅获取、放置和删除
允许请求。

【问题讨论】:

    标签: jquery ruby-on-rails http-status-code-405


    【解决方案1】:

    您是否为该操作设置了路线?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-20
      • 2023-03-23
      • 2011-06-21
      • 2011-04-05
      • 2014-05-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多