无法从php访问我的Json输出

时间:2016-07-23 16:17:12

标签: php angularjs

我有包含

的PHP文件(car_insert.php)
$datasuccess = array(
    "name" => "Person Name",
    "email" => "Person email",
    "phone" => "phone"
);
echo json_encode($datasuccess);

我的angularjs代码是

$scope.insertCarInfo=function(){
    $http.post("car_insert.php",{
        'REMARKS':$scope.REMARKS,
        'buttonName':$scope.buttonName})
            .success(function(datasuccess){
                $scope.name = datasuccess.name;
                $scope.email= datasuccess.email;
                $scope.carDisplay();
            });
    };

我的HTML(index.php)文件的代码是:

Name:{{name}}
email:{{email}}

我无法获得任何输出

1 个答案:

答案 0 :(得分:0)

$scope.name = datasuccess.name;
$scope.email= datasuccess.email;
$scope.carDisplay();
$scope.$apply();//insert this code.