$(document).ready(function() { RefreshTitlesINLOVE(); }); function addTimeStamp(){ tstmp = new Date(); return tstmp.getTime(); } function RefreshTitlesINLOVE() { $.ajax({ type: "GET", url: "https://onair.e-radio.gr/whatson/akous/akousinlove/NowOnAir.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowTitleArtistINLOVE }); $.ajax({ type: "GET", url: "https://onair.e-radio.gr/whatson/akous/akousinlove/AirPlayNext.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowNextSongsINLOVE }); } function ShowTitleArtistINLOVE(xml) { $(xml).find("Song").each(function() { $("#INLOVE_title").html($(this).attr("title")); $(xml).find("Artist").each(function() { $("#INLOVE_artist").html($(this).attr("name")); }); }); } function ShowNextSongsINLOVE(xml) { var j=0; $(xml).find("Song").each(function() { if (j==0 ){ $("#INLOVE_nexttitle").html( $(this).attr("title") ); $("#INLOVE_nextartist").html( $(this).find("Artist").attr("name") ); } j=j+1; }); } var oRefreshINLOVE; oRefreshINLOVE = window.setInterval("RefreshTitlesINLOVE()", 50000);