Javascript - DOM - CSV

javascript-dom

How can we dump a two dimensional JavaScript array to a CSV on the client side without using server side resource?

var csv_content = array_for_export.join("\n");
var download_element = $('#download_link')[0];
download_element.setAttribute("href", "data:text/csv;charset=utf-8,%EF%BB%BF" + encodeURI(csv_content));
download_element.setAttribute("download", "email_validation_result.csv");
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License