jQuery - $.getJSON Twitter
This example shows how to get your tweets using $.getJSON and displaying them in a unordered list.
uses empty, fadeOut, fadeIn, getJSON, bind, each
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<div id="input">
<span>Enter File within git/git repo</span>
<input id="filename" type="text" value="README"/>
<button id="getContributors">Get Contributors</button>
</div>
<div id="output"></div>
JavaScript
$("#getContributors").bind("click", function() {
var filename = $("#filename").val();
var url = "https://api.github.com/repos/git/git/commits?path=" + filename
$.getJSON(url, function(data) {
var twitterList = $("<ul />");
$.each(data, function(index, item) {
if(item.author) {
$("<li />", {
"text": item.author.html_url
}).appendTo(twitterList);
}
});
$("#output").fadeOut("fast", function() {
$(this).empty().append(twitterList).fadeIn(1000);
});
})
.done(function() { alert("another chained success"); })
.fail(function() { alert("chained error"); })
.always(function() { alert("chained complete"); });
;
});