开发者

Why doesn't this code retrieve the resource? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I'm trying to fetch an image from facebook. Why doesn't this code 开发者_JAVA技巧retrieve the image?

<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>

<div id="fb-root"></div>
    <script type="text/javascript">
window.fbAsyncInit = function() {
        FB.init({
            appId:XXXXX, cookie: true, status: true,  xfbml: true 
        });
};

  (function() {
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
  }());
</script>

<script>
var profilePicsDiv = document.getElementById('profile_pics');
FB.getLoginStatus(function(response) {
  if (response.status != 'connected') {
    profilePicsDiv.innerHTML = '<em>You are not connected</em>';
    return;
  }

  FB.api({ method: 'friends.get' }, function(result) {
    Log.info('friends.get response', result);
    var markup = '';
    var numFriends = result ? Math.min(5, result.length) : 0;
    if (numFriends > 0) {
      for (var i=0; i<numFriends; i++) {
        markup += (
          '<fb:profile-pic size="square" ' +
                          'uid="' + result[i] + '" ' +
                          'facebook-logo="true"' +
          '></fb:profile-pic>'
        );
      }
    }
    profilePicsDiv.innerHTML = markup;
    FB.XFBML.parse(profilePicsDiv);
  });
});
</script>


Your div is lacking a <:

<div id="profile_pics"></div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜