Facebook API
by andyjh07
HTML
<body>
<div class="facebookfeed">
<h2>Loading...</h2>
</div>
</body>
JavaScript
$(function () {
//http://graph.facebook.com/summersproperty displays all the handlers, use json.likes, json.username etc to display this stuff
var url = "https://graph.facebook.com/summersproperty?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 = "We have " + json.likes + " likes for the account " + json.name + " (" + json.username + ").";
//A little animation once fetched
$('.facebookfeed').animate({
opacity: 0
}, 500, function () {
$('.facebookfeed').html(html);
});
$('.facebookfeed').animate({
opacity: 1
}, 500);
});
});