I am trying to show a download pop up to the user which is an ajax call giving text/csv formatted response.
The issue: it's working well in Firefox but not in Chrome, where it's opening a new tab. This is definitely unintended, and I would prefer it didn't happen. Any ideas on what I could change...?
function x() {
  var obj = jQuery("input:checked").map(function() 
  { 
    return jQuery(this).parents('tr').attr('id'); 
  });
  var result = null;
  var arr = jQuery.makeArray(obj);
  var data = arr.join(',');
  $.ajax({
    url : '<%= url_for :controller => "liges", :action => "export_to_csv" %>',
    type : 'POST',
    data : {data:data},
    dataType : 'string',
    async: false,
    success : function(response) { 
      window.open('data:text/csv;charset=utf-8,'+escape(response)); 
    }    
  }); 
};
 
     
     
    