jquery Ajax请求示例,jquery Ajax基本请求方法示例

jquery Ajax请求示例,jquery Ajax基本请求方法示例

 

================================

©Copyright 蕃薯耀 2018年5月7日

https://www.cnblogs.com/fanshuyao/

 

 

 

Js代码  
  1. $.ajax({  
  2.     //async: false,//设置为同步,默认为异步(一般不需要)  
  3.     url : "xxx/xxx.html",  
  4.     type : "post",  
  5.     //dataType : "json",  
  6.     data : {  
  7.         "method" : "bb",  
  8.         "doc_no" : "aa"  
  9.     },  
  10.     complete : function(XMLHttpRequest, textStatus){  
  11.         //alert("textStatus="+textStatus);  
  12.         //closeLoading();//关闭进度条  
  13.     },  
  14.     error : function(XMLHttpRequest, textStatus, errorThrown){  
  15.         //closeLoading();//关闭进度条  
  16.         if("error" == textStatus){  
  17.             //$.messager.alert("系统提示", "服务器未响应,请稍候再试", "info");  
  18.         }else{  
  19.             //$.messager.alert("系统提示", "请求失败,textStatus="+textStatus, "info");  
  20.         }  
  21.      },  
  22.      success : function(data){  
  23.          if(data != null){  
  24.              if("success" == data.result){  
  25.                  //TODO  
  26.              }else{  
  27.                 // $.messager.alert("系统提示", "操作失败,请重试", "info");  
  28.              }  
  29.              //console.log("result = " + data.result + ",msg=" + data.msg);//IE不支持console输出  
  30.          }else{  
  31.              //$.messager.alert("系统提示","返回结果为空!","info");  
  32.          }  
  33.      }  
  34. });  

 

 

================================

©Copyright 蕃薯耀 2018年5月7日

https://www.cnblogs.com/fanshuyao/

posted @ 2018-05-11 11:42  蕃薯耀  阅读(416)  评论(1编辑  收藏  举报