Three step process
You need three steps :
1) Use Ajax to fetch data from your server and turn it into an array. You could do this eg. with the following jQuery :
$.ajax({
type: "GET",
url: "data.csv",
success: CSVToHTMLTable
});
2) Once you have get your CSV file, you need to parse it. An easy & reliable way to do it, would be to use a library like Papa Parse :
var data = Papa.parse(data).data;
3) You need to define a function to transform your array into an HTML table. Here's how you could do this with jQuery :
function arrayToTable(tableData) {
var table = $('');
$(tableData).each(function (i, rowData) {
var row = $('
');
$(rowData).each(function (j, cellData) {
row.append($(''+cellData+' | '));
});
table.append(row);
});
return table;
}
Putting everything together
Here's how you can put everything together :