Weird “406 not acceptable” error

前端 未结 12 1177
南方客
南方客 2020-11-27 05:38

When I try to hit this action via Javascript, I get a 406 Not Acceptable error:

  def show
    @annotation = Annotation.find_by_id(params[:id])
         


        
12条回答
  •  天命终不由人
    2020-11-27 06:06

    If you are using jRails this was causing a lot of problems for me, here is my application.js file:

    $(document).ready(function () {
        $.ajaxSetup({
            beforeSend: function (xhr) {
                xhr.setRequestHeader("Accept", "text/javascript, text/html, application/xml, text/xml, */*");
            }
        });
    });
    

提交回复
热议问题