Using facebook javascript sdk to process fql query

后端 未结 3 618
刺人心
刺人心 2020-12-22 01:08

I have just put implemented Facebook connect on my web-site using the JavaScript SDK. Now I would like to process an fql query.

So I have two questions:

3条回答
  •  佛祖请我去吃肉
    2020-12-22 01:22

    Sorry I can't comment yet but to clarify this helpful answer; what worked for me was formatting the FQL API call the same way I would a Graph API call with {fields: "ex1,ex2"}:

    var fqlRequest = "SELECT name FROM user WHERE uid = me()";
    FB.api("/fql",{q:fqlRequest}, function(response){
        // do cool stuff with response here
    });
    

    Note that I did NOT have to URL encode the string and it worked fine for me (I had used encodeURI(fqlRequest) before and it returned an unexpected % error).

    Also remember to quote literals if you use them:

    var id = "1234567890";
    var fqlRequest = "SELECT name FROM user WHERE uid = ' " + id + " ' ";
    

提交回复
热议问题