$(document).ready(function() { RefreshTitlesDREAMS(); }); function addTimeStamp(){ tstmp = new Date(); return tstmp.getTime(); } function RefreshTitlesDREAMS() { $.ajax({ type: "GET", url: "https://onair.e-radio.gr/whatson/akous/akousdreams/NowOnAir.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowTitleArtistDREAMS }); $.ajax({ type: "GET", url: "https://onair.e-radio.gr/whatson/akous/akousdreams/AirPlayNext.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowNextSongsDREAMS }); } function ShowTitleArtistDREAMS(xml) { $(xml).find("Song").each(function() { $("#DREAMS_title").html($(this).attr("title")); $(xml).find("Artist").each(function() { $("#DREAMS_artist").html($(this).attr("name")); }); }); } function ShowNextSongsDREAMS(xml) { var j=0; $(xml).find("Song").each(function() { if (j==0 ){ $("#DREAMS_nexttitle").html( $(this).attr("title") ); $("#DREAMS_nextartist").html( $(this).find("Artist").attr("name") ); } j=j+1; }); } var oRefreshDREAMS; oRefreshDREAMS = window.setInterval("RefreshTitlesDREAMS()", 50000);