I'm learning how to access an array of JSON objects using AJAX but can't seem to access my data. I keep getting undefined when trying to access a certain value of object in the array. I know I have the data there as when I called console.log I got the result in the picture below...
I'm trying to get the first object in the array and get it's name value using this code...
$('document').ready(function(){
$.ajax({
    type: "POST",
    url: "web_services/cow/api.php",
    data: "{ rating: 4.7}",
    contentType: "application/json; charset=utf-8",
    cache : false,
    dataType: "json",
    success: function(data) {
        console.log(data[0]['name']);
    },
    error: function(){
       alert("There was an error loggin in");
    }
});
});
But I only get undefined unfortunately. Would the way I'm implementing this be okay or is there a better way?
Thank you very much for any help and taking the time to read my question.

