Facebook Javascript SDK:从Facebook处理响应 [英] Facebook Javascript SDK: Processing Response from Facebook

查看:123
本文介绍了Facebook Javascript SDK:从Facebook处理响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您对Facebook进行API调用时,我无法理解如何处理响应。应该提到我是新的javascript。

I'm having trouble understanding how to process the response when you make an API call to facebook. Should mention that I'm new to javascript.

说我想得到我和一些用户之间的共同的朋友,然后写入一个文本框。我拍了一个镜头,结果是这个失败了。我很确定这是因为我没有解析回应,但是我无法弄清楚如何。我已经看到像 query.wait(函数(rows){为FQL查询...但我不知道这意味着什么...我跳过它。

Say I want to get the mutual friends between me and some user, and then write it to a text box. I took a shot and ended up with this ...which failed. I'm pretty sure it's because I didn't parse the response, but I can't figure out how. I've seen something like query.wait(function(rows){ for FQL queries ... but I don't know what that means..so I skipped it.

function getMutual(){

    FB.api('/me/mutualfriends/'+target, function(response) {

            document.getElementById('debug').innerHTML =
            'FQL Information: '+  response +"<br />";
    });
}


推荐答案

的回调函数 function(response){,执行调试器; 语句,以在浏览器中开始调试,或您可以执行 console.dir(response); 来查看对象结构。一半的战斗学习javascript正在学习如何使用现代浏览器现在已经构建的一些强大的工具。

In the beginning of your callback function function(response) {, do either a debugger; statement to start debugging in your browser, or you can do a console.dir(response); to see the object structure. Half your battle learning javascript is learning how to use some powerful tools that modern browsers now have built in.

这篇关于Facebook Javascript SDK:从Facebook处理响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆