等待Ajax结果 再提交表单(ajax同步)

第一种方法:

如果使用的提交按钮是button 不是submit 以及服务器控件  可以在ajax返回结果之后document.getElementById('form').submit();

第二种:

function BeginSubmit() {
            var txt = "";
            jQuery.ajax({
                type:"POST",
                async:false,//是否异步   
url:
"GetTotalAmount.aspx", success:function(result){ if (result.text == "false") { DIVAlert('alert', 'Valor\'s Minimum Order Policy is $25.00. We welcome you to continue to browse and shop on our website, and thank you for your business!', null, null); return false; } else { if (validateForm() && GetTotalAmount()) { if (jQuery('[name=outOfStack]').length > 0) { if (!confirm('Out of stock Or offline products will add to backorder,Do you want to submit Order?')) return false; } else { if (!confirm('Do you want to submit Order?')) return false; } } else { return false; } ProcessOrder(); } } }) }

 

posted @ 2013-02-23 10:31  划破黑夜  阅读(2291)  评论(0编辑  收藏  举报