I have a web application that generates a CSV from a query to a BD, which I want to download, I am calling the route that generates the file through an Ajax request, but I have no idea how to download it. file.
$.ajax({
type: 'POST',
url: direccion() + 'descargas/exportar',
dataType: '//Que tipo deberia poner¿?'
}).done(function () {
//Aqui se debería guardar el archivo
}).fail(function (xhr, status, error) {
alert('Error ' + xhr.status + '. ' + error + ': ' + xhr.responseText);
});