Created
December 15, 2010 16:51
-
-
Save clifff/742237 to your computer and use it in GitHub Desktop.
javascript-last.fm-api jsonp callback non-uniqueness
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<script type="text/javascript" src="js/lastfm.api.md5.js"></script> | |
<script type="text/javascript" src="js/lastfm.api.js"></script> | |
<script type="text/javascript" src="js/lastfm.api.cache.js"></script> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script> | |
/* Create a LastFM object */ | |
var lastfm = new LastFM({ | |
apiKey : 'f21088bf9097b49ad4e7f487abab981e', | |
apiSecret : '7ccaec2093e33cded282ec7bc81c6fca' | |
}); | |
/* Load some artist info. */ | |
lastfm.user.getTopAlbums({user: 'clifff'}, {success: function(topAlbums){ | |
console.log(topAlbums); | |
$.each(topAlbums.topalbums.album, function(index, value){ | |
lastfm.album.getInfo({album: value.name, artist: value.artist.name}, | |
{success: function(albumInfo){ | |
console.log(value.artist.name + ' - ' + value.name); | |
console.log(albumInfo); | |
}}, | |
{error: function(code, message){ | |
}} | |
); | |
}); | |
}, error: function(code, message){ | |
/* Show error message. */ | |
}}); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment