I am generating the excel file in server side and writing it to the outpuststream with the following response headers.
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename="+fileName);
In my client side : An ajax call to the servlet as shown :
Ext.Ajax.request({
url: 'GenerateReport',
method: 'GET',
params: {
'start_date': sd.getValue(),
'end_date':ed.getValue()
}
});
Browser shows following Response Headers :
My Issue : The Open and Save dialog prompt is not opening.What may be the problem.Please help me resolve this.Any help is appreciated.Thanks.
Thanks @liya. I have resolved it by using iframe instead of ajax call.Its getting downloaded directly.Here it is :
Ext.core.DomHelper.append(document.body, {
tag : 'iframe',
id : 'downloadIframe',
frameBorder : 0,
width : 0,
height : 0,
css : 'display:none;visibility:hidden;height:0px;',
src : 'GenerateReport'
});
But Is their anyway,to open a dialog box before downloading,to prompt for 'OPEN' or 'SAVE' the file instead of saving it directly which I am doing.