Michael
Michael

Reputation: 522

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

Upvotes: 1

Views: 2596

Answers (1)

Brian Mains
Brian Mains

Reputation: 50728

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.

Upvotes: 2

Related Questions