$(document).ready(function() { wonder_RefreshTitleArtist(); }); function addTimeStamp(){ tstmp = new Date(); return tstmp.getTime(); } function wonder_RefreshTitleArtist() { $.ajax({ type: "GET", url: "/whatson/wonder/NowOnAir.xml?timestamp="+addTimeStamp(), dataType: "xml", success: wonder_ShowTitleArtist }); } function wonder_ShowTitleArtist(xml) { $(xml).find("Song").each(function() { $("#wonderTitle").html($(this).attr("title")); $(xml).find("Artist").each(function() { $("#wonderArtist").html($(this).attr("name")); }); }); } var oRefreshwonder; oRefreshwonder = window.setInterval("wonder_RefreshTitleArtist()", 50000);