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 FROM 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?