(using ASP.NET MVC) I am working on a page that generates an excel "report" on button click. The contents of the report depend on user selections, so it may take 5 seconds to generate, or it may take 30 seconds.
I am trying to figure out how execute browser-side code once the excel file is generated and begins downloading so that I can display a loading message and give them the option to generate additional reports.
When the user clicks the generate report button I am submitting a form:
$("#genReportBtn").click(function () {
...processing stuff...
$("#genContractForm").submit();
});
Which links to a FileResult type function on the server side:
public FileResult GenReport(...Variables...)
{
...Generating Excel File...
return File(output.ToArray(),
"application/vnd.ms-excel",
"report.xls");
}
Which starts the download.
Is there any way to detect this return browser side?