返回404代码

时间:2017-04-18 05:15:34

标签: angularjs

这是我的PHP代码

http_response_code(404);
$message = http_response_code()." No data found";
header('Content-Type: application/json');
echo json_encode($message);

这是我的AngularJS代码

app.controller('customersCtrl', function($scope, $http) {
    $scope.element = function(num){
        var element_id = num;//num;  
        $http.get("customers.php",{params:{"id":element_id}}).then(function (response) {
            $scope.myData = response.data;
        }
        ,function errorCallback(response){
            $scope.error=response.data;

        });

    };

});

如何返回404代码,或至少加载新页面以显示它?

0 个答案:

没有答案