最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - js papa.parse csv file from url, prevent cache - Stack Overflow

programmeradmin0浏览0评论

I am parsing a csv file that's on the server:

var readCSV = function(url){
    Papa.parse(url, {
        download: true,
        header: true,
        plete: function(results) {
            listen = results.data;
        }
    });
}

Unfortunately still reads an old file from cache even though I have already replaced it on the server. Is there some way to prevent it from using the cache?

I am parsing a csv file that's on the server:

var readCSV = function(url){
    Papa.parse(url, {
        download: true,
        header: true,
        plete: function(results) {
            listen = results.data;
        }
    });
}

Unfortunately still reads an old file from cache even though I have already replaced it on the server. Is there some way to prevent it from using the cache?

Share Improve this question asked Dec 29, 2017 at 8:46 ChrisChris 14.3k24 gold badges94 silver badges184 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

You could use a cachebuster to read your new file. So your URL should look like.

var readCSV = function(url){
    Papa.parse(url+"?_="+ (new Date).getTime(), {
        download: true,
        header: true,
        plete: function(results) {
            listen = results.data;
        }
    });
}
发布评论

评论列表(0)

  1. 暂无评论