I would like to display the last 10 songs played on a web page. Here's the code I'm using but I'm unable to retrieve and display the requested info from the json file. https://jsfiddle.net/Heropiggy95/6qkv7z3b/ Can someone point out the errors or demonstrate a working example? Thank you.
$(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