I use the following route to create a excel file. The Excel is created correctly, and is created in the root folder, where also is the template.xlsx i am using.
app.get('/proceso/:id', function(req, res)
{
res.download( __dirname + "/report.xlsx")
});
If i call the route directly in the browser, for example localhost:7555/proceso/2 the file is generated and a download starts automatically.
I want to use an ajax get request to call the route,
function reporte_excel(idp){
$.ajax({
type : "GET",
contentType : "application/json",
url : "/proceso/"+ idp,
success: function (data)
{
}
});
};
Now the file is generated but no download starts. Is there a way to start the download on client side inside of ajax success? Or how should the download be started on server side?