2018年1月16日 星期二

關於 Jqery Ajax 參數 簡單說明

  

   $.ajax({
         url: "", //網址
         type: 'POST', // 預設為 get
         data: null, // 傳送檔案 
         async: false, //是否為同步
         cache: false, //是否可暫存
         dataType : "json", //回傳 檔案 型別
         contentType: false, // 設定使用原定的傳輸協定
         processData: false, // 傳送檔案是否為序列化資料
         success: function (data) { // 成功時
          alert(data.XXX);
          
         },
         error : function(jqXHR, textStatus, errorThrown) { //發生錯誤時
                alert("發生錯誤:" + errorThrown);
         },
          beforeSend:function(){ //送出前
        //alert('show londing');
  },
  complete:function(){//完成後 不管有無錯誤
       //alert('unshow londing');
  }

});

沒有留言:

張貼留言