Facebook API Javascript JSON response

前端 未结 3 2069
执笔经年
执笔经年 2021-02-06 17:48
function getUser()
{
    FB.api(\'/me\', function(response) {
       console.log(\'Response is \'+response);
       alert(\'Your name is \' + response.first_name);
              


        
3条回答
  •  醉酒成梦
    2021-02-06 18:30

    i think you have to use FB Graph api. and if you want more information then you have to use like this

    https://graph.facebook.com/579156356
    
    https://graph.facebook.com/btaylor?access_token=AAAAAAITEghMBAHTRFEKjKcvFe1W2NJTu1Gsy20cNWEe0Dh98KoOhJEInZB1kXrMprNUaN6nq8FZA7YMZBvNVLwuz6pglh1SIBbZCnEECOAZDZD
    

    i am useing like this.

    function(evt){
         console.log(evt.target.responseText);
         var FB_obj = JSON.parse(evt.target.responseText);
         console.log("fb id >>"+FB_obj.id);
         console.log("fb name >>"+FB_obj.name);
    }
    

提交回复
热议问题