Fixing problem with getJSON(), using ajax() instead. Damn you, JSONP.

This commit is contained in:
Klaus Silveira
2012-07-06 11:34:49 -03:00
parent 4b6fb0a6f5
commit e3cf2aa94d

View File

@@ -1,16 +1,20 @@
$(function(){
$.getJSON('https://api.github.com/repos/klaussilveira/gitlist/contributors', function(data) {
var items = [];
$.ajax({
url: 'https://api.github.com/repos/klaussilveira/gitlist/contributors',
dataType: 'jsonp',
success: function(data) {
var items = [];
$.each(data, function(key, val) {
items.push('<li><a href="' + val.url + '" rel="avatarover" data-placement="top" data-title="' + val.login + '" data-content="' + val.login + ' has made ' + val.contributions + ' contributions to GitList"><img src="' + val.avatar_url + '" width="32" height="32" /></a></li>');
});
$.each(data.data, function(key, val) {
items.push('<li><a href="' + val.url + '" rel="avatarover" data-placement="top" data-title="' + val.login + '" data-content="' + val.login + ' has made ' + val.contributions + ' contributions to GitList"><img src="' + val.avatar_url + '" width="32" height="32" /></a></li>');
});
$('<ul/>', {
'class': 'contributor-list',
html: items.join('')
}).appendTo('#contributors');
$('[rel=avatarover]').popover();
$('<ul/>', {
'class': 'contributor-list',
html: items.join('')
}).appendTo('#contributors');
$('[rel=avatarover]').popover();
}
});
$('[rel=carousel]').carousel();