I know there are lot of questions of this nature but I need to do this using JavaScript. I am using Dojo 1.8 and have all the attribute info in array, which looks like this:
[["name1", "city_name1", ...]["name2", "city_name2", ...]]
Any idea how I can export this to CSV on the client side?


You can do this in native JavaScript. You'll have to parse your data into correct CSV format as so (assuming you are using an array of arrays for your data as you have described in the question):
or the shorter way (using arrow functions):
Then you can use JavaScript's
window.openandencodeURIfunctions to download the CSV file like so:Edit:
If you want to give your file a specific name, you have to do things a little differently since this is not supported accessing a data URI using thewindow.openmethod. In order to achieve this, you can create a hidden<a>DOM node and set itsdownloadattribute as follows: