title: Export grid data to a CSV file and save it with extension .csv by just using Javascript/JQuery
body: <p>I have found several code that helps me generate a CSV file. But i am not able to save it with an extension of .csv</p>
  
  <p>I am using the following code to generate a csv file, but i need to save the file with .csv as extension </p>
  
  <pre><code>var ExportToCSV= function (gridData, fileName, humanize, ignore){
  
             var csv = '',
             data = [],
          ignore = [];
  
                                                                           if (!ignore) {
          ignore = [];
      }
  
      //ignore added datasource properties       
      var commonIgnore = ["_events", "idField", "_defaultId", "constructor", "init", "get",
          "_set", "wrap", "bind", "one", "first", "trigger",
          "unbind", "uid", "dirty", "parent"];
      ignore = $.merge($.merge([], ignore), commonIgnore);
  
       var data= gridData._data;
  
  
  
      //add the header row
      if (data.length &gt; 0) {
          for (var col in data[0]) {
              //do not include inherited properties
              if (!data[0].hasOwnProperty(col) || ($.inArray(col, ignore) &gt; -1)) {
                  continue;
              }
  
              if (humanize) {
                  col = col.split('_').join(' ').replace(/([A-Z])/g, ' $1');
              }
  
              col = col.replace(/"/g, '""');
              csv += '"' + col + '"';
              if (col != data[0].length - 1) {
                  csv += ",";
              }
          }
          csv += "\n";
      }
  
      //add each row of data
      for (var row in data) {
          for (var col in data[row]) {
              //do not include inherited properties
              if (!data[row].hasOwnProperty(col) || ($.inArray(col, ignore) &gt; -1)) {
                  continue;
              }
  
              var value = data[row][col];
              if (value === null) {
                  value = "";
              } else if (value instanceof Date) {
                  value = kendo.toString(kendo.parseDate(value),"dd/MM/yyyy");
              } else {
                  value = value.toString();
              }
  
              value = value.replace(/"/g, '""');
              csv += '"' + value + '"';
              if (col != data[row].length - 1) {
                  csv += ",";
              }
          }
          csv += "\n";
      }
  
      //TODO replace with downloadify so we can get proper file naming
      window.open("data:application/csv;charset=utf-8," + escape(csv));
  </code></pre>
  
  <p>};  </p>
  
  <p>There are many ways using server-side code like php, asp.net, java to resolve the issue. But can anybody help me achieve the same by just using client-side scripting i.e using Javascript/JQuery.</p>
  
  <p>Thanks a lot for your help.</p>