Sep 04, 2019 07:16 AM|PatriceSc|LINK
Using jQuery ? My first thought would be to check the response header:
https://stackoverflow.com/questions/1557602/jquery-and-ajax-response-header for the text/html content type to show or trigger the download dialog. This last point can be done from Ajax using a trick such as https://stackoverflow.com/questions/20830309/download-file-using-an-ajax-request
I would still double check if it brings a real benefit and would try to make sure a simpler design can't fit my need.
Edit: ah or you meant you want to show a message "after" the download. I'm not sure it's really easy. The common pattern is likely to show a message when the download is triggered else it would be rather #2 above and then you do whatever you want after that.
Note that it prevents moving away from the page while the browser handles the download...