Angular JS:http.post在Internet Explorer中返回null

Pab*_*blo 9 javascript ajax internet-explorer angularjs

我正在从Angular JS做一个ajax调用:

var response = $http.post(
    '/services/login/?_nochache='+new Date().getTime(),      
    JSON.stringify(credentials)
);
Run Code Online (Sandbox Code Playgroud)

我正在添加_nocache设置,认为可能是某些缓存或类似的东西.

我也将对象credentials转换为字符串,认为Internet Explorer无法识别该对象.

我真的迷失在这里,在Chrome中调用完美,在IE 10中,服务的响应为空.

是什么导致这个?

编辑

该服务返回401,这是好的,因为用户错了,但响应应该(如在其他浏览器中一样),错误字符串表示用户错误,在这种情况下为空.

我正在使用这样的承诺:

promise.then(onLoginOk, onLoginError);
...

function onLoginError(response) {
   console.log(JSON.stringify(response));
}
Run Code Online (Sandbox Code Playgroud)

控制台返回

{
  "data": null,
  "status": -1,
  "config": {
    "method": "POST",
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "url": "http://dev.site.com:8000/api/auth/login/",
    "data": {
      "username": "mail@domain.com",
      "password": "password"
    },
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/json;charset=utf-8"
    }
  },
  "statusText": ""
}
Run Code Online (Sandbox Code Playgroud)

编辑

这是我在IE中获得的响应主体. 在此输入图像描述

这些是我得到的标题401是正确的,但响应正文是错误的. 在此输入图像描述

Dyl*_*ght 0

这有点夸张,如果我错了,请不要发疯。没有代表点发表评论。

你看过这篇文章吗? 错误 401 和 403 仅在 Internet Explorer 中出现(不适用于 Chrome、Firefox 等)- IIS 配置?