javascript - Get changes in JQuery Ajax request -


my apologies if seems dumb, how implement function when ajax data changed last request?

window.setinterval(function(){     $.get("feed", function(data){          if (data.changed) {              $('#feed').html(data);          }     }); }, 500); 

something cache data , compare after each request?

var data;  window.setinterval(function(){     $.get("feed", function(newdata){          if (data !== newdata) {             data = newdata;             $('#feed').html(data);          }     }); }, 500); 

also, 500ms regular checking requests, i'd advise changing 5000ms or something.


Comments

Popular posts from this blog

xslt - Substring before throwing error -

Google Cloud Bigtable Durability/Availability Guarantees -

Android M doze mode and "native" posix socket freezing up -