首页 > 解决方案 > 从 PHP MySql 访问 $http.post 请求中的 JSON 数据

问题描述

有没有办法在函数内部从 $http.post PHP mysql 访问 json 数据,如下所示:

$scope.getAllNamesList = function() {
    $http.post("database/selectall_names.php", {user_id: $scope.selectedUserID})
    .then(function(response){
        $scope.names = response.data;

        if(response.data.user_city == "xxx")
            {
               $scope.selectedCity = response.data.user_city;
            }
    });
}

标签: phpangularjs

解决方案


推荐阅读