gpt4 book ai didi

Jquery 文件下载 ($.fileDownload)

转载 作者:行者123 更新时间:2023-12-03 22:34:52 26 4
gpt4 key购买 nike

我正在使用jquery文件下载..

代码如下:

 function downloadFile(){
var downloadOptions = {
preparingMessageHtml: "We are preparing your report, please wait...",
failMessageHtml: "No reports generated. No Survey data is available."
};

$.fileDownload("displaySurveyReport.action",downloadOptions);
return false;
}

这就是我在单击按钮时所做的

当我单击按钮时,准备消息Html:“我们正在准备您的报告,请稍候...”,显示在对话框中...问题是该对话框在文件完成准备后不会关闭,我必须手动关闭它......当文件完成准备并准备下载时,我怎样才能使它关闭..

谢谢

最佳答案

为了让 JQuery 知道刚刚发生了文件下载,您的响应 header 必须包含 Set-Cookie: fileDownload=true;路径=/

在 Java 中:

response.setHeader("Set-Cookie", "fileDownload=true; path=/");

关于Jquery 文件下载 ($.fileDownload),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13853300/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com