开发者

How to print/fetch the data taken from an FQL query?

开发者 https://www.devze.com 2023-03-15 22:30 出处:网络
It may sound a bit funny but i don\'t know how to fetch the data taken from a facebook FQL query using javascript. I was looking all over the n开发者_如何学Goet and there is only tutorials on how to r

It may sound a bit funny but i don't know how to fetch the data taken from a facebook FQL query using javascript. I was looking all over the n开发者_如何学Goet and there is only tutorials on how to run the query but now how to fetch the data.

so here is the code i have:

         if (response.session) {
         FB.api({
         method: "fql.query",
         query: "SELECT name,email FROM user WHERE uid = " + response.session.uid
         });
                                            customar_formcode="'.$formcode.'";
                                            customar_formcode=customar_formcode.replace("{email}", USER EMAIL FROM THE FQL);
                                            customar_formcode=customar_formcode.replace("{name}", USER NAME FROM THE FQL);
                                            document.getElementById('form').submit();

So how to place user's name and email where "USER EMAIL FROM THE FQL" and "USER NAME FROM THE FQL".

Thanks.


You have to define callback function:

FB.api({
         method: "fql.query",
         query: "SELECT name,email FROM user WHERE uid = " + response.session.uid
         },
function(response) {
 //Here you have acces to response from FB.
 //Use console.log(response) (in firebug in FF) to watch what is in it:)
}
);
0

精彩评论

暂无评论...
验证码 换一张
取 消