IE9 AJAX对Rails的调用失败

I am trying to sent a PATCH request from the client to the rails backend.

This works fine in FF/Chrome and IE10+.

The problem seems to be XDomainRequest. I am using jQuery and tried to just send a POST request and change it to PATCH with'X-Http-Method-Override': 'PATCH'.

Unfortunately it seems that IE9 does not allow to set custom headers, since it does not show up in the HTTP Request.

On the backend I get errors, because the route for a POST request is not found.

I also tried appending _method=patch to the URL params and _method: "patch" to the request body, but it still doesnt work. Also I can not change the Content-Type to anything else than Plain/Text in IE9.

Is there any way to sent a POST request from IE9 and get it recognized as a PATCH Request by my Rails Backend?

2015/10/07 14:59
  • Internet-explorer
  • ruby-on-rails
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答