Compare Ajax Data Results

I have an ajax function which is set to run every few seconds through a setInterval function, which is fine and it works. The data is being logged in the console and it’s returning “5” for example, so every few seconds the number 5 is being logged in the console. But if I click a button, the data will change and log the number 6 for example, so now after a few seconds, the console is logging the number 6. I just need to know how do I get the ajax call to recognise when the number changes to a different number? How do I essentially compare the data between each ajax call and if there is a difference between the latest call and the previous call, then do something with that information?

Any information would be incredibly helpful. Thanks in advance!

Read more here:: Compare Ajax Data Results

Leave a Reply

Your email address will not be published. Required fields are marked *