Created
June 11, 2012 21:01
-
-
Save anonymous/2912675 to your computer and use it in GitHub Desktop.
Issues with FB.init called inside a FbReady callback
This file contains 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 getFriendsInApp = function( callback ){ | |
var friends = "SELECT uid, name, pic_square FROM user WHERE uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())" | |
, friends_in_app = "SELECT uid, name, pic_square FROM user WHERE is_app_user AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())" | |
console.log( FB ); | |
FB.api({ | |
method: 'fql.query', | |
query: friends_in_app | |
}, callback ); | |
}; | |
$(function( ){ | |
$( document ).bind( 'FbReady', function(){ | |
FB.init({ | |
appId : '268829123210262', // App ID | |
status : false, // check login status | |
cookie : true, // enable cookies to allow the server to access the session | |
xfbml : false // parse XFBML | |
}); | |
try { | |
getFriendsInApp( function(res){ console.log( res ) }); | |
} catch( exception ) { | |
log( "ERROR:", exception ) | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment