简体   繁体   English

Facebook登录按钮回调

[英]Facebook login button callback

Working with Facebook Login 使用Facebook登录

The code is as follows, 代码如下,

   <div id="fb-root"></div>
<div class="fb-login-button"  data-width="200" onlogin="GetData()"></div>
<script>
                window.fbAsyncInit = function () {
                FB.init({
                        appId: 'My ID',
                        status: false,
                        cookie: true,
                        xfbml: true,
                        oauth: true
                });
                };        
                (function (d) {
                var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
                js = d.createElement('script'); js.id = id; js.async = true;
                js.src = "//connect.facebook.net/en_US/all.js";
                d.getElementsByTagName('head')[0].appendChild(js);
                } (document));

        function GetData()
        {
        alert(11);
        }

</script>

1-it is working fine but the function GetData do not call after the user press facebook login button 2- I want write code in this function to give me the email,use name , ... information about this user 1-它工作正常,但是在用户按下facebook登录按钮后不会调用GetData函数2-我想在此函数中编写代码以向我发送电子邮件,使用名称,...有关该用户的信息

Call this function for facebook login your GetData function called after user logged . 为Facebook登录调用此函数,以便在用户登录后调用您的GetData函数。

function facebooklogin(){ 函数facebooklogin(){

  FB.login(function(response) {
     if (response.authResponse) {
             GetData();
        });

        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM