Ver Mensaje Individual
  #3 (permalink)  
Antiguo 31/05/2013, 05:27
Avatar de randy05
randy05
 
Fecha de Ingreso: agosto-2012
Mensajes: 37
Antigüedad: 12 años, 2 meses
Puntos: 1
Respuesta: Facebook connect de este tutorial

exacto es eso lo que no logro entender mira el escript

<head>
<script>
function AjaxResponse()
{
var myData = 'connect=1'; //For demo, we will pass a post variable, Check process_facebook.php
jQuery.ajax({
type: "POST",
url: "process_facebook.php",
dataType:"html",
data:myData,
success:function(response){
$("#results").html('<fieldset style="padding:20px">'+response+'</fieldset>'); //Result
},
error:function (xhr, ajaxOptions, thrownError){
$("#results").html('<fieldset style="padding:20px;color:red;">'+thrownError+'</fieldset>'); //Error
}
});
}

function LodingAnimate() //Show loading Image
{
$("#LoginButton").hide(); //hide login button once user authorize the application
$("#results").html('<img src="ajax-loader.gif" /> Please Wait Connecting...'); //show loading image while we process user
}

function ResetAnimate() //Reset User button
{
$("#LoginButton").show(); //Show login button
$("#results").html(''); //reset element html
}

</script>
</head>


Y este es el Boton de facebook

<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '<?php echo $appId; ?>',cookie: true,xfbml: true,channelUrl: '<?php echo $return_url; ?>channel.php',oauth: true});};
(function() {var e = document.createElement('script');
e.async = true;e.src = document.location.protocol +'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);}());

function CallAfterLogin(){
FB.login(function(response) {
if (response.status === "connected")
{
LodingAnimate(); //Animate login
FB.api('/me', function(data) {
if(data.email == null)
{
//Facbeook user email is empty, you can check something like this.
alert("You must allow us to access your email id!");
ResetAnimate();

}else{
AjaxResponse();
}
});
}
});
}

</script>