I have a button in my Application, when user click on that button, my server suppose to download a file. This entire process I have achived with following code
It's working fine, but I want to use
ajax call instead of
window.location. Because when user click on button I am planning to show loading process.once download done, I have to remove that. Apart from this, I can show both error and success messages.
server side code in
res.setHeader('Content-Type','application/vnd.openxmlformats') res.setHeader("Content-Disposition","attachment; filename=test.csv"); res.end(result, 'binary');
window.location, I am unable to get any response because, whatever
URL,I have mention it's not comes under current window scope.
How can I achive this.