我想顯示網頁上播放的最後10首歌曲。這裏是我正在使用的代碼,但我無法從json文件中檢索和顯示請求的信息。 https://jsfiddle.net/Heropiggy95/6qkv7z3b/有人可以指出錯誤或展示一個工作示例嗎?謝謝。需要幫助解析json網頁上的數據
$(document).ready(function() {
$.getJSON("http://apps.radioactive.sg/lastsongsplayed.php?stationId=995fm&callback=myfunction", function(data) {
var html = ''; // declare the variable that will be used to store the information
$.each(data.myfunction, function(i, item) {
{
html += 'Song: ' + item.song.track + ', Artist: ' + item.song.artist + ', Time: ' + item.playedtime + '';
} //
}); //
$('.nowplaying').append(html); // print the information to the document with a span class of 'nowplaying' and use the jQuery append method to insert the information.
}); // close JSON call
}); // close document ready function
'它不是working'可能是你能提供的最糟糕的信息。請給一些更多的細節。 – C4u