HTML表单返回并下载文件时显示进度掩码
Show progress mask when HTML form post back and downloads file
我是javascript和HTML的新手。当我的html表单被张贴并下载文件时,我正在努力显示繁忙的图像。我正在使用http://malsup.com/jquery/form/#options-对象插件。我正在使用IE 9。我寄回了一张表格,作为回报,我收到了一份文件。
当我发帖时,我看到繁忙的掩码,然后IE要求我保存为文件,但掩码不会消失。没有调用成功/错误回调。下面是我的代码快照。
非常感谢您为解决此问题提供的指导。
`frmExport.html
<head>
<script src="js/jquery-1.8.0.js"></script>
<script src="js/jquery.form.js"></script>
<script src="js/frmExport.js"></script>
</head>
<body onload="......">
<form id="frmExport" onsubmit="return exportFile();" enctype="multipart/form-data" method="post">
<fieldset>
<legend class="cuesGroupBoxTitle">Export File</legend>
<table border="0" cellpadding="0" cellspacing="8">
<tr>
<td width="50%">Export File:</td>
<td><input type="submit" id="ExportFileButton" value="Export" /></td>
</tr>
</table>
</fieldset>
</form>
</body>
frmExport.js
function exportSuccess(responseText, statusText, xhr, $form)
{
hideMask("exportFile");
alert(statusText");
}
function exportError()
{
hideMask("exportFile");
alert("An error occurred while exporting file.");
}
function exportFile()
{
if(confirm("Exporting file may take sometime. Do you want to continue?"))
{
var options =
{
type: "POST",
success: exportSuccess, // post-submit callback
error: exportError,
url: 'exportURI',
dataType: 'text'
};
// bind to the form's submit event
$('#frmExport').submit(function()
{
$(this).ajaxSubmit(options);
showMask("exportFile");
//always return false
return false;
});
}
}`
我敢肯定,您的问题是在提交已经触发时挂接提交事件($('#frmExport').submit(...)
)。试着把它挂在文档上。准备好。
$(document).ready(function() {
var options =
{
type: "POST",
success: exportSuccess, // post-submit callback
error: exportError,
url: 'exportURI',
dataType: 'text'
};
// bind to the form's submit event
$('#frmExport').submit(function()
{
$(this).ajaxSubmit(options);
showMask("exportFile");
//always return false
return false;
});
});
相关文章:
- 如何为jQuery屏蔽输入插件创建一个允许字母数字、空格和重音字符的掩码
- 从右到左输入掩码
- 如何在引导程序元素的顶部添加掩码
- 在筛选网格期间,网格负载掩码不起作用
- 将形状/掩码动态添加到内联svg中
- 输入文本的掩码
- 在javascript中动态修改掩码高度
- 在sencha touch中列出掩码
- 如何使用angularjs在剑道网格过滤器文本框中应用电话号码掩码
- jQuery:在验证错误之后,我的输入掩码函数不会'Don’不要在野外工作
- 网格负载掩码获胜'使用PagingMemoryProxy时不会消失
- 带有jQuery和屏蔽输入插件的手机掩码
- 当SVG是单独的文件时,剪辑路径/web工具包掩码有效,但在内联时无效
- AngularJS ui掩码为货币添加最大值和最小值
- 为什么jQuery掩码说它'It’这不是函数
- vTiger和jQuery手机掩码
- HTML表单返回并下载文件时显示进度掩码
- 使用JS或Jquery-是否可以有一个只读字段,该字段显示有掩码,但在复制时不显示掩码值
- 当显示加载掩码时,我如何禁用用户操作
- 隐藏和显示输入掩码