Jquery文件下载($ .fileDownload) [英] Jquery File download ($.fileDownload)

查看:4759
本文介绍了Jquery文件下载($ .fileDownload)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using jquery file download ..

代码如下:

 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; 
}

这是我正在按钮点击

当我点击按钮,prepareMessageHtml:我们正在准备你的报告,请稍候...,显示在一个对话框...
问题是,这个对话框在完成准备之后不会关闭,我必须手动关闭...
如何让它关闭,当文件完成准备并准备下载..

When i click on the button , the preparingMessageHtml: "We are preparing your report, please wait...", is shown in a dialog box ... The problem is that this dialog box does not go off after the fle completes its preparing and i have to close it manually ... How can i make it go off when the file completes its preparation and is ready to download..

谢谢

推荐答案

p>为了使JQuery知道文件下载,您的响应头必须包含 Set-Cookie:fileDownload = true;路径= /

In order to make JQuery knows the file download just ocurred, your response header must contains Set-Cookie: fileDownload=true; path=/.

在Java中:

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

这篇关于Jquery文件下载($ .fileDownload)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆