i am starting to build a facebook extension app. i got the api auth part working. now as i request anything using the javascript api, i am unable to.
for example:
<div id="profile_pics"></div>
<script type="text/javascript">
var widget_div = document.getElementById("profile_pics");
FB.ensureInit(function () {
FB.Facebook.get_sessionState().waitUntilReady(function() {
FB.Facebook.apiClient.friends_get(null, function(result) {
var markup = "";
var num_friends = result ? Math.min(5, result.length) : 0;
if (num_friends > 0) {
for (var i=0; i<num_friends; i++) {
markup +=
'<fb:profile-pic size="square" uid="'+result[i]+'" facebook-logo="true"></fb:profile-pic>';
}
}
widget_div.innerHTML = markup;
FB.XFBML.Host.parseDomElement(widget_div);
});
});
});
</script>
the above sample code should display square thumbnail images of my friends. it just shows square thumbs (BLANKS) with the facebook logo over it. where am i going wrong?
FYI: i have the files located in the localhost. in the facebook application settings, i gave the connect url as the address of the 'localhost/dir/index.html' url. is there something i am doing wrong? please help me out.
EDIT this the code i am using to make login:
<script type="text/javascript">
//<![CDATA[
var api_key = 'myapikey';
var channel_path = '/xd_receiver.htm';
FB_RequireFeatures(["Api"],
function(){
// Create an ApiClient object, passing app's API key and
// a site relative URL to xd_receiver.htm
FB.Facebook.init(api_key, channel_path);
var api = FB.Facebook.apiClient; // require user to login
api.requireLogin(function(exception)
{
FB.FBDebug.logLevel=1;
FB.FBDebug.dump("Current user id is " + api.get_session().uid);
// Get friends list
//5-14-09: this code below is broken, correct code follows //
//api.friends_get(null, function(result){
// Debug.dump(result, 'friendsResult from non-batch execution ');
// });
api.friends_get(new Array(), function(result, exception){
FB.FBDebug.dump(result, 'friendsResult from non-batch execution ');
});
});
});
//]]>