admin管理员组

文章数量:1417102

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;
        }
    });
}

本文标签: javascriptjs papaparse csv file from urlprevent cacheStack Overflow