-1

I'm trying to get value from response JSON data. How can i get the values domain, status, key.

Response JSON data:

{"example.com":{"status":"YES","key":"example"}}

Angular JS Code

$http.post('http://exampleURL.com', postData).success(function(response){
     console.log(response);
     alert();
   }).error(function() {

   });
user1999
  • 1
  • 1

1 Answers1

1

use angular.fromJson to parse JSON then traverse it using .

$http.post('http://exampleURL.com', postData).success(function(response){
    console.log(response);
    var data = angular.fromJson(response); 
    console.log(data['example.com'].status);    
}).error(function() {

});
uladzimir
  • 5,639
  • 6
  • 31
  • 50
Ajay Narain Mathur
  • 5,326
  • 2
  • 20
  • 32