일부 연구를 수행 한 후 특정 팬 페이지에있는 "좋아하는"수만 인쇄하려고합니다. ,하지만 아무것도 당기지 않습니다. 어떤 도움이 필요합니까?JSONP 및 JQuery를 사용하여 facebook 팬 페이지에서 좋아하는 수를 가져 오려고 시도합니다.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
function fbFetch(){
//Set Url of JSON data from the facebook graph api. make sure callback is set with a '?' to overcome the cross domain problems with JSON
var url = "https://graph.facebook.com/tenniswarehouse?callback=?";
//Use jQuery getJSON method to fetch the data from the url and then create our unordered list with the relevant data.
$.getJSON(url,function(json){
var html = "<ul>
<li>" + likes + "</li>
</ul>";
//A little animation once fetched
$('.facebookfeed').animate({opacity:0}, 500, function(){
$('.facebookfeed').html(html);
});
$('.facebookfeed').animate({opacity:1}, 500);
});
};
</script>
</head>
<body onload="fbFetch()">
<div class="facebookfeed">
<h2>Loading...</h2>
</div>
</body>
</html>
여전히 작동하지 않습니다. - 그 콜백 =? 다른 도메인 (페이스 북) –
에서 JSON을 가져 오기 때문에 내 업데이트를 확인하기 때문입니다. – bkaid
놀라운 감사합니다 !!!! –