$(document).ready(function() { RefreshTitlesMUSICES(); }); function addTimeStamp(){ tstmp = new Date(); return tstmp.getTime(); } function RefreshTitlesMUSICES() { $.ajax({ type: "GET", url: "https://onair.e-radio.gr/whatson/akous/akousgazi/NowOnAir.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowTitleArtistMUSICES }); $.ajax({ type: "GET", url: "https://onair.e-radio.gr/whatson/akous/akousgazi/AirPlayNext.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowNextSongsMUSICES }); } function ShowTitleArtistMUSICES(xml) { $(xml).find("Song").each(function() { $("#MUSICES_title").html($(this).attr("title")); $(xml).find("Artist").each(function() { $("#MUSICES_artist").html($(this).attr("name")); }); }); } function ShowNextSongsMUSICES(xml) { var j=0; $(xml).find("Song").each(function() { if (j==0 ){ $("#MUSICES_nexttitle").html( $(this).attr("title") ); $("#MUSICES_nextartist").html( $(this).find("Artist").attr("name") ); } j=j+1; }); } var oRefreshMUSICES; oRefreshMUSICES = window.setInterval("RefreshTitlesMUSICES()", 50000);