Help i have the following code which shows the cd cover of the song that plays in my website. This image reload every 30 secont.
That i want is every 30 secont to check if the image change and if he change he will refresh it if not the image will not refresh. (Sorry for my English)
Here is the code of html.Code:jQuery(document).ready(function() { pollstation(); setInterval(pollstation, 30000); }); function requestCrossDomain( callback ) { var yql = 'yql.php?callback=?'; jQuery.getJSON( yql, cbFunc ); function cbFunc(data) { if ( data ) { data = data[0].results.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, ''); data = data.replace(/<html[^>]*>/gi, ''); data = data.replace(/<\/html>/gi, ''); data = data.replace(/<body[^>]*>/gi, ''); data = data.replace(/<\/body>/gi, ''); if ( typeof callback === 'function') { callback(data); } } else throw new Error('Nothing returned from getJSON.'); } } function pollstation() { requestCrossDomain(function(stationdata) { var lines = stationdata.split('<br/>'); jQuery('#cdcover').html('<img width="90" height="90" title="" src="/live/pic/cd_cover/' + encodeURIComponent(jQuery.trim(lines[1])) + '.jpg" border=0 alt=""/>'); } ); }
Code:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script src="jquery.min.js" type="text/javascript"></script> <script src="videos2.js" type="text/javascript"></script> </head> <body style= leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <div style="width: 366px; height: 223px;" id="cdcover"></div> </body> </html>


Reply With Quote
Bookmarks