【发布时间】:2017-05-23 06:52:35
【问题描述】:
我的服务器动态生成 excel 文件。我正在使用 AJAX 下载动态 excel 文件。在成功回调中,我收到了 excel 文件数据。
$.ajax({
url: exporting.action,
headers: { "Authorization": "Basic " + btoa("key : " + key) },
type: "post",
success: function(res){
//res is the excel file that needs to be downloaded
//I know we can download image using anchor tag but not sure about excel file
},
data: { 'Model': JSON.stringify(modelClone) }
});
请在锚标签的href属性中建议如何使用这些数据进行下载?
注意:
1) 我需要 AJAX 来进行标头授权
【问题讨论】:
标签: javascript ajax excel download