Facebook FQL Question
I'm trying to use the Facebook Javascript API to run FQL queries, and it works fine if I try and get users by username or uid, but doesn't work when I'm searching by name.
function get_username()
{
var name = prompt("Enter name: ")
FB.api(
{
method: 'fql.query',
query: 'SELECT username FRO开发者_高级运维M user WHERE name in "'+name+'"'
},
function(response) {
var x = response[0].username
alert('Username is ' + x);
}
);
}
I realize that this will probably return multiple users, but I can't figure out how to tell if it's returning multiple users or no users at all, it seems to freeze after trying to get response[0].username.
I'm probably making a beginner mistake but any ideas?
Check this out: http://developers.facebook.com/docs/reference/fql/user
I don't see a username field. I think that's the issue.
HTH.
精彩评论