Reputation: 506
I have a ajax download functionality in my MVC webapp.
User can select a criteria and click on export button. Internally it will fetch data and return an Excel file. up to this functionality is working fine. But the issue occurs, While one download process is running and now user changes the filter criteria and again click on export button. Now two download processes are running. Whichever process completes first will return file to download. Now the user can see Open, save, cancel option to download first file. As this stage when second download request is also completed and returns file to download. When I opens one file the another file download option is also lost.
Initially I thought it might because both the files are having same name. So I made changes to set unique file name for every request. But It still gives only single file to download.
Can anyone help me on this?
edited : On other pages where I have two different types of files to download, the above functionality works successfully.
Upvotes: 0
Views: 1099
Reputation: 662
In none ajax requests, page can only be waiting for one response. In order to solve that problem and wait for multiple responses you should use target attribute with value "new" as the following code depicts:
<a href="your download Url" target="New">Your download Text</a>
The above code makes each response to be downloaded in a new tab.
Upvotes: 2