总是容易忘记 jquery ajax POST

 1 $.ajax({
 2     //提交数据的类型 POST GET
 3     type:"POST",
 4     //提交的网址
 5     url:"testLogin.aspx",
 6     //提交的数据
 7     data:{Name:"sanmao",Password:"sanmaoword"},
 8     //返回数据的格式
 9     datatype: "html",//"xml", "html", "script", "json", "jsonp", "text".
10     //在请求之前调用的函数
11     beforeSend:function(){$("#msg").html("logining");},
12     //成功返回之后调用的函数             
13     success:function(data){
14         $("#msg").html(decodeURI(data));
15     }   ,
16     //调用执行后调用的函数
17     complete: function(XMLHttpRequest, textStatus){
18         alert(XMLHttpRequest.responseText);
19         alert(textStatus);
20         //HideLoading();
21     },
22     //调用出错执行的函数
23     error: function(){
24         //请求出错处理
25     }
26 }); 

 

posted @ 2016-01-28 13:08  SunsCheung  阅读(120)  评论(0编辑  收藏  举报