I'm new to JS and trying to get my last.fm toptracks
over the last 7 days with a limit of 3 from their API here:
Here's my code below which works but whenever I change the limit
to more than 1
, it fails with no console error. Any idea how I can use .html
to print out an array of those 3 track names?
$.getJSON("http://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=thisisheroic&period=7day&limit=1&api_key=3cbc1a3aa903935d08223263bcc3ba0b&format=json", function(result){
$.each(result, function(){
$('#lastfm_toptracks').html(result.toptracks.track.name);
});
});