Created
March 15, 2014 23:53
-
-
Save Kolesias123/9575745 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var status; | |
$(document).on('ready', function() | |
{ | |
$('#abrir').on('click', FBInit); | |
$.ajaxSetup({ cache: true }); | |
$.getScript('//connect.facebook.net/es_LA/all.js', function() | |
{ | |
FB.init({ | |
appId: '508675409251649', | |
}); | |
$('#loginbutton,#feedbutton').removeAttr('disabled'); | |
FB.getLoginStatus( function( e ) | |
{ | |
status = e.status; | |
}); | |
}); | |
}); | |
function FBInit() | |
{ | |
if ( status == 'connected' ) | |
PublicarEstado(); | |
else | |
FB.login( PublicarEstado, {scope: 'publish_actions'} ); | |
} | |
function PublicarEstado() | |
{ | |
FB.api('/me/feed', 'post', {message: 'Te he hackeado!'} ); | |
} | |
function Publicar() | |
{ | |
FB.ui( | |
{ | |
method: 'feed', | |
name: 'Mi primera App con la API de Facebook', | |
caption: 'Caption', | |
link: 'http://www.infosmart.mx/' | |
}, | |
function(res) | |
{ | |
// La publicación se ha hecho en Facebook | |
if ( res && res.post_id ) | |
{ | |
alert('Publicación hecha!'); | |
} | |
else | |
{ | |
alert('No hemos podido hacer la publicación'); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment