需要使用Response.AddHeader实现文件下载功能,但是打开对应的网页时并没有弹出文件保存对话框,数据就直接显示在了网页里,不知道是代码问题还是IE浏览器的设置问题?还是$.post的问题?
js代码如下:
$.post('./Include/saveHeaderExcel.asp',
{Data : header},
function(data)
{
window.location.href = './Include/exportXL.asp'
}
);
需要下载的exportXL.asp网页代码如下:
Response.ContentType="text/plain"
Response.AddHeader "Content-Disposition","attachement; filename=ExcelExport.csv"