码迷,mamicode.com
首页 > Web开发 > 详细

jquery post 提交等待 同步处理

时间:2014-11-17 19:12:32      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   os   sp   div   on   问题   

post可以实现同步和异步,在不同的场景应用不同的方式。在引导向导中,用户提供表单应该等待服务器返回状态才能进行下一步。

 bootbox.dialog({message: "请耐心等待,正在向服务器提交任务...", });
						//提交创建任务
						console.log(‘ajax‘)

						
							$.ajax({
       								type: ‘POST‘,
        							url: ‘/task/testpost/‘,
        							async: false,
        							data: {
        									
        									‘taskContent‘:$("#step2_taskcontent").text(),
        									‘taskCreatorID‘:$(‘#username‘).text(),

        									‘workers[]‘:$("#step1_workers").val(),
        									‘name‘:‘test‘,
        								},

        							success: function(data){

        								bootbox.hideAll()

										$(‘#wizard_left‘).hide()
										//return false

       								 },

       								 error: function(XMLHttpRequest, textStatus, errorThrown) {
       								 	bootbox.hideAll()
       								 	//console.log(‘error‘)
                        				//alert(XMLHttpRequest.status);
                       					 //alert(XMLHttpRequest.readyState);
                        				alert("创建服务单失败,可能是网络连接有问题,请与管理员联系。错误:"+textStatus+","+XMLHttpRequest.status+","+XMLHttpRequest.readyState);
										return false
                        			}
									//参数结束

   						 });

 

 

jquery post 提交等待 同步处理

标签:blog   http   io   ar   os   sp   div   on   问题   

原文地址:http://www.cnblogs.com/springran/p/4103970.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!