I am currently using window.location.href to download a file, but this method requires a second call to my servlet which takes about 1 minute to generate the file. How can I download the file using XMLHTTPRequest instead? The solution should only work with Internet Explorer 7+ browsers. Is there a way to obtain the file without using window.location.href?
Ext.Ajax.request({
url : fileUrl,
success : function(response){
var resp = response.responseText;
if (resp.indexOf('error')>-1){
//some logic
}else{
window.location.href = fileUrl;
}
}
}
});