I am using Facebooks Javascript API
in my jQuery Mobile Website
in order to import the albums
and photos
of a facebook page
.
Its fairly easy to use the API :
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'YOUR_APP_ID', // App ID from the app dashboard
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel file for x-domain comms
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
// Additional initialization code such as adding Event Listeners goes here
FB.api('16907099963/albums', checkForErrorFirst(getAlbums));
};
// Load the SDK asynchronously
(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/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
As you see i make a call to the API here : FB.api('16907099963/albums',checkForErrorFirst(getAlbums));
which will give me all the albums of this page. The call is asynchronous
. I need to find a way to be able to know when the call has finished. But i really cant find any callback functions
here..
The API can be found here
The reason i am asking for this , is that i need to add a jquery mobile "loading" widget , before i call the API and make it stop when the albums have rendered. Any idea on this one?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…