// Source: https://blog.mounirmesselmeni.de/2012/11/20/reading-csv-file-with-javascript-and-html5-file-api/ // Source: https://www.js-tutorials.com/javascript-tutorial/reading-csv-file-using-javascript-html5/ // Source: https://stackoverflow.com/questions/13329853/reading-server-file-with-javascript function handleFile() { // Check for the various File API support. if (window.FileReader) { // FileReader are supported. var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (xmlhttp.status == 200 && xmlhttp.readyState == 4) { processData(xmlhttp.responseText); } }; xmlhttp.open("GET", "world_data_v1.csv", true); xmlhttp.send(); } else { alert('FileReader are not supported in this browser.'); } } function processData(csv) { var table = ""; var allTextLines = csv.split(/\r\n|\n/); for (var i = 0; i < allTextLines.length; i++) { var data = allTextLines[i].split(';'); table += ""; for (var j = 0; j < data.length; j++) { table += ""; } table += "
"; table += data[j]; table += ""; } table += "
"; document.getElementById('table_bla').innerHTML = table; }