How to clear the cache for JSON

后端 未结 1 1948
情歌与酒
情歌与酒 2021-01-14 13:44

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

相关标签:
1条回答
  • 2021-01-14 13:55

    use $.ajaxSetup settings

    $.ajaxSetup({
      cache:false
    });
    

    after that you can use your code like

    function readEye() {
      $.getJSON('output.json', function(data){
        console.log(data);
      });
    }
    
    0 讨论(0)
提交回复
热议问题