So I\'ve got this local file named \'data.json\' containing various data. I want to refresh my page only when some data in the json file changes. Appreciate your help if you
You want to examine your json file in a very thorough way, in order to understand if it has changed. So what you should do is:
getJSON()
to load the initial data from your json file to a localStorage object.then use jQuery getJSON()
in a timed loop to get new data from your json file, compare them in-deep and very strict way with a little help from this awsome function posted as an answer in a similar question here. If your localStorage objects, initial JSON
and new JSON
match Object.deepEquals(initialJSON, newJSON)
then no change was made, if not then refresh the page.