我有下载文件的链接,这个过程有时很长,所以我想要一个 JQ 模式对话框来显示,通知用户正在下载。
使用 JQuery 模态:http: //jqueryui.com/demos/dialog/#modal
@model MvcResComm.Models.FileList
@{
ViewBag.Title = "Download";
}
<script src="../../Scripts/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.20.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('a').click(function () {
$("#dialog-modal").dialog({
height: 140,
modal: true
}, 'open');
});
});
</script>
<h2>Download</h2>
<table>
@foreach (KeyValuePair<string, string> item in Model.Files) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Value)
</td>
<td>
@Html.ActionLink("Download", "DownloadFile", new { fileid = item.Key, token = Model.Token, platform = "windows" })
</td>
</tr>
}
</table>
<div id="dialog-modal" title="Basic modal dialog">
<p>Download in progress.</p><span class="loading"> </span>
</div>