Reputation: 11
I have question about JSON and JavaScript. So through web page I update JSON file and then save it to the server. Then I go to the page where there must be listed the information from the JSON but it visualisates the old information of the JSON even after refreshing the page. Only when I open a new window of web browser then it list the latest JSON. I search for any cache but there is nothing and don't know where is the problem. So how to visualisate the updated JSON after refreshing page?
I am fethching the information by jQuery:
$.getJSON("json2.json", function(json) {
console.log(json[0]); // this will show the info it in firebug console
var count = Object.keys(json).length;
console.log(count);
for(var i=0; i<count; i++){}});
This is no the full code but i can't publish it all because it so long.
Upvotes: 1
Views: 198
Reputation: 33933
This is probably due to browser cache, since this is the same filename.
Add this before your $.getJSON(...
:
$.ajaxSetup({
cache:false
});
;)
Upvotes: 1