I'm using PapaParse to download CSV files from my JavaScript scripts and it's working great.
However, I've got a page where I need to download two files and only then do some work, and I was wondering if there was a neater way to do this than this:
Papa.parse(url_seriesy, {
download: true,
header: true,
keepEmptyRows: false,
skipEmptyLines: true,
error: function(err, file, inputElem, reason) { // handle },
complete: function(y_results) {
Papa.parse(url_seriesx, {
download: true,
header: true,
keepEmptyRows: false,
skipEmptyLines: true,
error: function(err, file, inputElem, reason) { // handle },
complete: function(x_results) {
console.log(x_results.data);
}
});
}
});
This works, but is pretty unwieldy. Is there anything else I can do? Perhaps I could use promises?