I\'m trying to build a \"Export to CSV\" system using ajax so this is my ajax call
$(document).on(\'click\', \'#export-csv\', function(){
$.ajax({
Try creating a
element with href
attribute set to data URI
of file using URL.createObjectURL
, Blob
; download
attribute to set file name for "Save file" dialog
success: function (data) {
var resp = data.response;
var a = $("", {
href: "data:text/csv,"
+ URL.createObjectURL(new Blob([resp], {
type:"text/csv"
})),
"download":"filename.csv"
});
$("body").append(a);
a[0].click();
}