var xhr = new XMLHttpRequest();
xhr.open("POST", "./technologyRuleHandler.ashx?Oper=download&path=" + $("#downloadText").val(), true);
xhr.responseType = "blob";
xhr.onload = function () {
if (this.status == 200) {
var blob = this.response;
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload = function (e) {
var a = document.createElement('a');
a.download = $("#downloadText").val();
a.href = e.target.result;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
$("#downloadModal").modal('hide');
}
};
xhr.send();
后台下载,前端响应下载
最新推荐文章于 2024-04-12 10:56:49 发布