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
            }
        })
    
    评论

报告相同问题?