IE 和 jQuery 帖子无法正常工作

IE and jQuery posts are not working

我正在尝试 post 使用 jQuery ajax 到我的后端,它适用于除 Internet Explorer(即 11)之外的所有浏览器。

我是否缺少 IE 的某些内容?

var example = "example/1234";

jQuery.post('#{test_path}', {
    uri: example
}, function(r) {
    if (r.status === 201) {  
      // success
    } else {
      // failure 
    }
});

我支持 test_path

def test
  render :json => {:status => 401}
end

edit: 代码挂了。 post 从未到达我的控制器,控制台日志保持空白并且网络选项卡不显示任何 post 信息。

尝试将 uri(字符串)作为第一个参数,而不是在该对象中,例如。 g.:

jQuery.post('/some/uri', {
    myPostDataKey: 'myPostDataValue'
}, function(r) {
    if (r.status === 201) {  
      // success
    } else {
      // failure 
    }
});