【发布时间】:2018-10-11 03:49:34
【问题描述】:
我已经可以从我的 Spotify 帐户中获取上次播放曲目的曲目和艺术家。代码:
$.getJSON("http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&user=xxxxxx&api_key=xxxxxxxxx&limit=2&nowplaying=false&format=json&callback=?", function(data) {
var html = '';
var counter = 1;
$.each(data.recenttracks.track, function(i, item) {
if(counter == 1) {
html += '<span>' + item.name + '<br /> ' + item.artist['#text'] + '</span>' + item.image;
}
counter++
});
$('.listening-to').append(html);
});
但 item.image 产生:
undefined
【问题讨论】:
-
不要投票也不要回答!
标签: javascript api last.fm