使用 FB.data.query 没有得到任何响应
我试图通过以下方式获取用户性别和出生日期:
FB.api('/me', function(response) {
var query = FB.Data.query('select birthday, gender from user where owner={0}',
response.id);
query.wait(function(rows) {
console.log(rows[0].birthday);
console.log(rows[0].gender);
alert(rows[0].birthday);
alert(rows[0].gender);
});
});
但是,我在控制台上看不到任何内容,也没有任何警报。这是为什么呢?
I am trying to get the user gender and birth date through the following:
FB.api('/me', function(response) {
var query = FB.Data.query('select birthday, gender from user where owner={0}',
response.id);
query.wait(function(rows) {
console.log(rows[0].birthday);
console.log(rows[0].gender);
alert(rows[0].birthday);
alert(rows[0].gender);
});
});
However, I see nothing on the console and there is no alert. Why is this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要经过身份验证的用户(/me)的生日和性别,您可以像这样访问用户对象:
如果您希望生日和性别来自用户表,则不能使用“性别”字段,因为它不存在。用“性”来代替。
您没有收到任何响应,因为您尝试访问不存在的字段。
If you want the birthday and gender of an authenticated user (/me) you can just access the User Object like this:
If you want the birthday and gender to come from the user table you can't use the "gender" field because it doesn't exist. Use "sex" instead.
You received no response because you were trying to access a field that doesn't exist.