I have this interval, that does an ajax request, currently every 5 seconds. I am having an issue with the if statement. my code ALWAYS enters it, and the two js
One solution would be to read the json data as text instead of json, and on success you check if the response string from the server differs from the last response string. Then you can call JSON.parse on the string. But this makes the comparison much easier and should only need a slight modification of your code.