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

jquery Ajax請求示例,jquery Ajax基本請求方法示例html

 

================================jquery

©Copyright 蕃薯耀 2018年5月7日ajax

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

 

 

 

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/async

相關文章
相關標籤/搜索