0

私はhtml、facebookグラフAPI、jqueryの初心者です。

Facebookのファンページ(一般的なプロフィールではない)のすべてのアルバムを取得して単純な形式で表示する次のコードがあります.chromeの開発者コンソールにエラーは表示されませんが、写真は表示されません. Facebookのファンページからすべての写真を表示する方法について何かアイデアはありますか?

<!DOCTYPE html>
<html>
 <head>
   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/
     1.4.2/jquery.min.js"></script>
 </head>
  <body onLoad="fbFetch()">


  <script>
     function fbFetch(){

      var url = "https://graph.facebook.com/160407767374259/photos?limit=5?callback=";


        $.getJSON(url,function(json){
           var html = "<ul>";


        $.each(json.data,function(i,fb){
          html += "<li><img alt='"+ fb.from.name +"' height='" + fb.height + "' width='" +
    fb.width + "' src='" + fb.picture + "'/></li><div style='clear:both;'>&nbsp;</div>";
});

html += "</ul>";


$('.facebookfeed').animate({opacity:0}, 500, function(){
 $('.facebookfeed').html(html);
 });
 $('.facebookfeed').animate({opacity:1}, 500);
 });
 };

4

1 に答える 1

2

重要な DOM 対応ラッパーがありません

<script>
$(function(){ 
    // code here
}); 
</script>

http://docs.jquery.com/Tutorials:Introducing_$(document).ready()

動作デモ

于 2012-11-26T15:54:55.977 に答える