Recently, I've been facing an issue with my AJAX call to the API. Previously, it was functioning correctly and returning a response JSON. However, now I am unable to retrieve any JSON object. When using Mozilla, no error is shown but the response JSON is missing. On the other hand, Chrome displays net::ERR_INSECURE_RESPONSE.
Here is the 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);
});
}
});