Comparing two json arrays

后端 未结 3 1443
忘掉有多难
忘掉有多难 2020-12-21 00:57

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

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-21 01:50

    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.

提交回复
热议问题