我需要运行下载然后继续执行代码吗?我该怎么办?
此功能正在检查文件何时被下载到我的服务器上,然后我需要运行下载到我的客户端计算机,女巫是我尝试 window.open("url") 的地方。
function checkSpreadsheetProgress(taskId, filename) {
var intervalId2 = setInterval(function () {
$.post("SpreadSheetProgress", { id: taskId }, function (SpreadSheetProgress) {
if (SpreadSheetProgress >= 100) {
clearInterval(intervalId2);
window.open("http://formvalue.co.za/download/" + filename + ".xlsx")
//The line above is my attempt at running the download link but it did nothing?
//The line below pushes me to my Downloadcompleate action result.
window.location.href = "downloadcomplete?filename=" + filename;
} else {
}
});
}, 100);
}
我可以使用 C# 下载文件,但无法继续使用重定向方法背后的代码。
public ActionResult DownloadComplete(string filename)
{
//return Redirect("http://formvalue.co.za/download/" + filename + ".xlsx");
// The above line will download the file but then i cant return a view?
return View();
}