JQuery Condition [change data only when it's different] -


i have jquery code , want refresh content when it's different new data
html code $title.html "div#title>h4"

function onair() {     $.ajax({         url: 'player.php', // json content file         data: "",         datatype: 'json',         success: function (data) {             var artiste = data[0];             var titre = data[1];             var title = data[2];             var cover = data[3];             var $cover = $("#cover"),                 $title = $("#title");              if ( $title.html != title ) {                 $cover.fadeout(300, function (data) {                     $cover.html("<img src='" + cover + "' width='220px' height='210px'>");                     $cover.fadein(300);                 });                 $title.fadeout(300, function (data) {                     $title.html("<h4> " + title + " </h4>");                     $title.fadein(300);                 });             }              settimeout("onair()", 1000);          } 

thank :)

make 2 changes:

1.

// note `text` must invoke if ( $title.text().trim() != title  )  

2.

settimeout(function () {     onair(); }, 1000); 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -