I want to export the exist data into csv file. I try to use this code:
var uriContent = "data:text/csv;charset=utf-8," + encodeURIComponent(data);
var myWindow = window.open(uriContent);
myWindow.focus();
it works but I can design filename. I can only get the dialog with name like "MVeAnkW8.csv.part" which I don't know where the name come from.
How can I assign filename in the first dialog? Thanks in advance.
update:
I am now using rails. Actually I have a method in server side names export_to_csv. In end of this method, I use code like that:
  send_data(csv_string,
  :type => 'text/csv; charset=utf-8;',
  :filename => "myfile.csv")
It works and I can specify the file name. For now, I want to use ajax to get more csv files(that is the reason why I want to use javascript, because a normal http request can only get one file to be downloaded).
I use js code like that:
$.post("export_to_csv",
 function(data) {
 var uriContent = "data:text/csv;charset=utf-8," + encodeURIComponent(data);
     var myWindow = window.open(uriContent);
     myWindow.focus();});     
It get the data from server side and I try to transfer it into csv. I can get a file but can't specify the file name.
 
     
    