小编Ida*_*dan的帖子

如何使用Facebook Graph API检索用户所在国家/地区?

我想检索登录的用户所在国家/地区,并将其插入到div中.我成功地使用用户姓名,性别和年龄范围,但有些人为什么我无法检索国家.这是我的代码:

  function testAPI() {
console.log('Welcome!  Fetching your information.... ');
FB.api('/me?fields=name,email,gender,age_range,picture,country', function (response) {
  document.getElementById('status').innerHTML = response.name + ",";
  document.getElementById('status1').innerHTML = response.gender + ",";
  document.getElementById('status2').innerHTML = (response.age_range.min) + "-" + (response.age_range.min + 1) + " years old";
  document.getElementById('status3').innerHTML = response.country;
}
Run Code Online (Sandbox Code Playgroud)

谢谢!

facebook-graph-api

16
推荐指数
2
解决办法
2万
查看次数

标签 统计

facebook-graph-api ×1