如何在文件下载后取消阻止 [英] How to unblockUI after the file gets download
本文介绍了如何在文件下载后取消阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每个人都在上传文件时给出了解决方案。
但是我需要一个解决方案在下载文件时我需要blockUI,一旦下载完成需要unblockUI
我在这里做的是生成一个文件Content然后我将保存在文件夹中
然后我从文件夹下载文件。
Hi ,
Everyone has given the solution while uploading the file.
But i need a solution "While Downloading a file i need to blockUI and once the download gets completed in need to unblockUI "
What Im doing here is will generate a file Content and then i will save in the folder
then im downloading the file from the folder.
$("#test").click(function (){
$.blockUI();
$.ajax({
type: "POST",
url: '../../Controller/GenerateFile',
data: "",
success: function (result) {
// debugger
window.location.href = '../../Controller/DownloadIFile?file=' + result;
$.unblockUI();
}
});
在DownloadFile的控制器中
In Controller for DownloadFile
public ActionResult DownloadFile(string file)
{
string fullPath = file;
return File(fullPath, "application/vnd.ms-excel", "FileName");
}
推荐答案
( #test)。click( function (){
("#test").click(function (){
.blockUI();
.blockUI();
.ajax({
type: POST,
url:' ../../ Controller / GenerateFile',
数据: ,
成功: function (result){
// debugger
window 。 location .href = ' < span class =code-string> ../../ Controller / DownloadIFile?file =' + result;
.ajax({ type: "POST", url: '../../Controller/GenerateFile', data: "", success: function (result) { // debugger window.location.href = '../../Controller/DownloadIFile?file=' + result;
这篇关于如何在文件下载后取消阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文