Collect email and send via post to php ( Facebook canvas )

Asked

Viewed 100 times

2

I’m making an app that’s right at the beginning, I worked really hard before asking for help here... I need to take the guy’s email and send it to php as a POST...

here is the code:

 window.fbAsyncInit = function() {
   FB.init({
      appId      : 'XXXXXXXXX',
      xfbml      : true,
      version    : 'v2.4'
    });
// Código

function onLogin(response) {
    if (response.status == 'connected') {
       FB.api('/me?fields=first_name', function(data) {
       var welcomeBlock = document.getElementById('fb-welcome');
       welcomeBlock.innerHTML = 'Hello, ' + data.first_name + '!';
});
 }
}


FB.getLoginStatus(function(response) {
  // Check login status on load, and if the user is
  // already logged in, go directly to the welcome message.
  if (response.status == 'connected') {
    onLogin(response);
  } else {
    // Otherwise, show Login dialog first.
    FB.login(function(response) {
     onLogin(response);
    }, {scope: 'email'});
  }
});



//Fim código
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));


</head>
<body>

<div class="container fundo">
    <div class="row">
        <div class="col-md-6">
            <img src="img/shopitoslogo.png" width="90%">
             <div class="row cadastro">
                 <div class="col-md-4 link "> <button class="btn btn-success">Instalar</button></div>
            </div>        
        </div>
        <div class="col-md-3 lado-direito">

        </div>
    </div>
    <div class="row">
        <div class="col-md-12"> <p>Que tal instalar nosso App em sua <br> Fan Page?</p></div>
</div>       
<div class="fb-like"
  data-share="true"
  data-width="450"
  data-show-faces="true">
</div>
    </div>


</div>


</body>
</html>
  • 2

    I got the result I wanted, I just edited the "Document.getElementById" for Document.getElementById('fb-Welcome'). value and added a form... uffa! was something really stupid, but I worked hard to do it.....

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.