Stack Exchange
Is it possible to get json data with url encode?
I am having datas in mysql i am converting that as json using url encoded,
I am using angularjs to fetch data this is my below angularjs code
This is my angular script:
angular
    .module('hameedApp', [])
    .controller('hameedController', function($scope, $http) {

        $http({
            method: 'GET',
            url: 'json2.php'
        }).then(function(response) {
            $scope.contacts = response.data;
        }).catch(function(response) {
            console.log('error');
        })
    });

This is my json2.php code:
       <?php   
       $connect = mysqli_connect("localhost", "root", "", "recruiter");  
       $sql = "SELECT * FROM recruiter";  
       $result = mysqli_query($connect, $sql);  
       $json_array = array();  
       while($row = mysqli_fetch_assoc($result))  
       {  
            $json_array[] = $row;  
       }  
       echo print_r(json_encode($json_array));  
       ?>

If i hit json2.php in postman url, successfully i got as json response,
If i put {{contacts}} in my html file, successfully i got json response, but if i use ng-repeat {{contact.somestuff}}, i did not get any data. Any ideas ?

Don't need print_r. What do you see output in {{contacts}}? Also show us the ng-repeat

hi @charlietfl i am hameed friend, who also working in his project, in {{contacts}} he have some json response

for example: {{name:sameer, age:20}} this is showing in html correctly

but if i choose tr(ng-repeat= 'contact in contacts') td{{contact.name}} name not displaying

Create a plunker demo that reproduces problem

It works ! @charlietfl

Got solution. I just removed print_r and its works ! 
       <?php   
       $connect = mysqli_connect("localhost", "root", "", "recruiter");  
       $sql = "SELECT * FROM recruiter";  
       $result = mysqli_query($connect, $sql);  
       $json_array = array();  
       while($row = mysqli_fetch_assoc($result))  
       {  
            $json_array[] = $row;  
       }  
       echo (json_encode($json_array));     
       ?>  

