Well, I’m fetching facebook likes by a user who has authenticated us already and checking if my page exists in it.
FB.api('/me/likes, function(response) {
console.log(response);
});
And I get the following in console (FireFox):
data
[Object { name="Excel in ABCD", category="Book", id="327361517327399", more...}, Object { name="LMNOPQ", category="Product/service", id="175625882542984", more...}, Object { name="UVWXYZ", category="Book", id="260641707360118", more...}, 7 more...]
0
Object { name="Excel in ABCD", category="Book", id="327361517327399", more...}
category
"Book"
created_time
"2012-04-04T05:31:04+0000"
id
"327361517327399"
name
"Excel in ABCD"
1
Object { name="LMNOPQ", category="Product/service", id="175625882542984", more...}
2
Object { name="UVWXYZ", category="Book", id="260641707360118", more...}
I want to access name from this, so with the help of “Baptiste Pernet” I tried the following:
FB.api('/me/likes, function(response) {
for(var i in response) {
console.log(response[i]);//gives me another object (it is nested, check below)
}
});
and this took me closer but not completely:
[Object { name=“Excel in ABCD”, category=“Book”, id=“327361517327399”, more…},
Object { name=“LMNOPQ”, category=“Product/service”, id=“175625882542984”, more…},
Object { name=“UVWXYZ”, category=“Book”, id=“260641707360118”, more…},
Now how do I access properties of the inner object?
Thanks