gpt4 book ai didi

angularjs - AngularJs http得到回应

转载 作者:行者123 更新时间:2023-12-03 09:06:13 26 4
gpt4 key购买 nike

这是我的HTTP获取请求

 $http({
method: 'GET',
url: baseURL + '/couponManager/createCoupon?token=' + token + query1 + query2 + query3 + query4 + query5,
}).then(function successCallback(response) {


if (response.status = 200)
{
$scope.showSuccessAlert = true;
$scope.successTextAlert = "Coupon successfully created!";
}

else if (response.status = 304)
{
$scope.errorAlert = true;
$scope.errorTextAlert = "Something Went Wrong, Please try again!";
}

}, function errorCallback(response) {

$scope.errorAlert = true;
$scope.errorTextAlert = "Can't reach server, please try later!";
});

这是我得到的回应
{"success":"no","data":{},"error_code":"DW3","error_description":"Server Error"}

但是我收到的状态仍然是200,如何从该响应中检索“error_description”和“status”?

最佳答案

更改条件if (response.status == 200)else if (response.status == 304)

关于angularjs - AngularJs http得到回应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43464349/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com