2016-07-23 89 views
0

輸出的Json我有一個包含廣東話訪問我從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(); 
      }); 
    }; 
PHP文件(car_insert.php)

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

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

我不能得到任何輸出

+1

嘗試json_encode($ datasuccess,JSON_FORCE_OBJECT); –

+0

*「無法訪問」究竟是什麼意思?成功處理程序會觸發嗎 – charlietfl

+0

當我試圖通過 'Name:{{name}} 電子郵件:{{email}}' 得到輸出時,無法在我的index.php中獲得任何輸出,但是我可以看到我的echo jason爲「{」name「 :「人名」,「電子郵件」:「個人電子郵件」,「電話」:「電話」}「在我的car_index.php –

回答

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