weixin_33709219 2015-08-07 16:54 采纳率: 0%
浏览 25

AJAX通话无回应

I am not getting any response from my AJAX call to the API. Few days back it was working fine and I was getting response JSON but now I am not able to get any JSON object. Mozilla does not give response JSON but shows no error but in Chrome I am getting net::ERR_INSECURE_RESPONSE

AngularJS code:

app.controller("LoginCtrl",
        function($scope, $http,$location,$rootScope) {
    $scope.login = function(user){
        $http({
            method: "POST",
            url: "https://aadvq11nwbv01.staples.com/wcs/resources/v1/member/login?storeId=10101&responseFormat=json",
            /*header: "Access-Control-Allow-Origin:*",*/
            header: "Content-Type: application/json",
            header: "Accept: application/json",
            data:{
                companyID: $scope.user.customerid,
                userID: $scope.user.userid,
                password: $scope.user.password
            }
        })
        .success(function (response){
            $rootScope.profile="xxx";
            userDetails = response;
            console.log(userDetails);
            $location.url("/profile")
        })
        .error(function (err){
            $scope.logerr="err";
            console.log(err);
        });
    }
});
  • 写回答

2条回答 默认 最新

  • weixin_33747129 2015-08-07 17:31
    关注

    The reason could be you have specified in wrong way. header should be an object then define its properties in it.

    Code

        $http({
            method: "POST",
            url: "https://aadvq11nwbv01.staples.com/wcs/resources/v1/member/login?storeId=10101&responseFormat=json",
            header: {
                "Content-Type: application/json",
                "Accept: application/json"
            },
            data:{
                companyID: $scope.user.customerid,
                userID: $scope.user.userid,
                password: $scope.user.password
            }
        })
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog