JQuery 从成功函数提交表单
使用 uploadprogress 插件在文件上传期间显示进度栏,并尝试从成功功能提交表单。但这不起作用。这是 uploadprogress 的 url:
http://nixboxdesigns.com/demos/jquery-uploadprogress.php
jQuery('#review_form').uploadProgress({
progressURL:'jquery-uploadprogress-demo-simple.php',
displayFields : ['kb_uploaded','kb_average','est_sec'],
start: function() {
jQuery('#upload-message').html('Uploading files now - please wait.');
jQuery('input[type=submit]',this).val('Uploading... PLEASE WAIT');
},
success: function() {
//$(this).unbind('submit').submit();
//$('#review_form').unbind('click');
//$('#review_form').unbind('submit');
// $('#review_form').submit();
// $('#review_form').trigger('submit');
jQuery(this).submit();
}
Using the uploadprogress plugin to show the Progress Bar during file upload and try to submit the form from success function. But it doesn't work. Here is the url of the uploadprogress:
http://nixboxdesigns.com/demos/jquery-uploadprogress.php
jQuery('#review_form').uploadProgress({
progressURL:'jquery-uploadprogress-demo-simple.php',
displayFields : ['kb_uploaded','kb_average','est_sec'],
start: function() {
jQuery('#upload-message').html('Uploading files now - please wait.');
jQuery('input[type=submit]',this).val('Uploading... PLEASE WAIT');
},
success: function() {
//$(this).unbind('submit').submit();
//$('#review_form').unbind('click');
//$('#review_form').unbind('submit');
// $('#review_form').submit();
// $('#review_form').trigger('submit');
jQuery(this).submit();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为什么不使用
jQuery(this).submit()
?Why not
jQuery(this).submit()
?从您的代码中我看到您正在尝试提交另一个表单 - review_form
不熟悉这个插件,但查看了他的示例,这应该可以工作:
$('#review_form').submit();
验证 review_form 是一个有效的表单(有一个操作)且 id="review_form"
from your code i see you are trying to submit another form - review_form
Not familiar with this plugin, but looked at his examples and this should work:
$('#review_form').submit();
verify that review_form is a valid form (has an action) with id="review_form"
进度条的工作与我的预期有所不同。包将表单提交到“form”操作属性中指定的位置。那里可以使用“文件”和其他表单元素。
我已经更改了代码以在那里进行实际工作并从调用页面重定向页面。因此,不需要我再次提交表格的问题。检查一个完整的示例:
http://www.ultramegatech.com/blog/2010/10/create-an-upload-progress-bar-with-php-and-jquery/
感谢所有帮助我的成员解决问题。尤其是“Avi Pinto”,提醒我做出回应的必要性。
The Progress Bar working is something different of what I expected. The package submitted the form to the location specified in the "form" action attribute. The "file" and other form elements are available there.
I have changed my code to do the actual working there and redirect the page from the calling page. Thus my question to submit the form again is not needed. check one complete example about this:
http://www.ultramegatech.com/blog/2010/10/create-an-upload-progress-bar-with-php-and-jquery/
Thank you for all members who helped me to resolve the issue. And especially "Avi Pinto" for reminding about the necessity of my responses.