Created
October 27, 2011 15:46
-
-
Save kopiro/1319942 to your computer and use it in GitHub Desktop.
Load the latest LastFM song in jQuery
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
loadLastFmSong = function(user, api) { | |
$.getJSON("http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user="+user+"&api_key="+api+"&format=json&callback=?", | |
function(json) { | |
lastfmtrack = json.recenttracks.track[0]; | |
$("#lastfm_song").html('<a target="_blank" href="'+lastfmtrack.url+'">'+lastfmtrack.name+", di "+lastfmtrack.artist["#text"]+'</a>'); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment