I'm reading a JSON file with jQuery. If I update the file that .get()
reads it still gets the old values when I read the newer file. Since I write and read the file every second, how can I solve this problem? Manually clearing the cache won't be a option.
function readEye() {
$.getJSON('output.json', function(data){
console.log(data);
});
}
I'm reading a JSON file with jQuery. If I update the file that .get()
reads it still gets the old values when I read the newer file. Since I write and read the file every second, how can I solve this problem? Manually clearing the cache won't be a option.
function readEye() {
$.getJSON('output.json', function(data){
console.log(data);
});
}
Share
Improve this question
edited Dec 31, 2011 at 20:12
ThinkingStiff
65.4k30 gold badges147 silver badges241 bronze badges
asked Dec 31, 2011 at 19:45
clankill3rclankill3r
9,58322 gold badges76 silver badges131 bronze badges
1 Answer
Reset to default 5use $.ajaxSetup
settings
$.ajaxSetup({
cache:false
});
after that you can use your code like
function readEye() {
$.getJSON('output.json', function(data){
console.log(data);
});
}