/**
* 公用方法:使用AJAX获取数据
* @param {[type]} param [参数]
* @param {[type]} url [路径]
* @param {[type]} callBack [成功的回调函数]
*/
function ajax(param, url, callBack) {
  $.ajax({
    type: "GET",
    url: serverUrl + url,
    data: $.param(param, true),
    success: callBack,
    error: function(xhr) {
      console.error("ERROR:" + url + ", xhr.status:" + xhr.status + ", xhr.statusText:" + xhr.statusText);
    }
  });
}
/**
* 公用方法:使用AJAX提交数据
* @param {[type]} param [参数]
* @param {[type]} url [路径]
* @param {[type]} callBack [成功的回调函数]
*/
function ajaxPost(param, url, callBack) {
  $.ajax({
    type: "POST",
    url: serverUrl + url,
    data: $.param(param, true),
    success: callBack,
    error: function(xhr) {
    console.error("ERROR:" + url + ", xhr.status:" + xhr.status + ", xhr.statusText:" + xhr.statusText);
    }
  });
}

相关文章:

  • 2022-12-23
  • 2021-12-12
  • 2022-01-11
  • 2021-09-11
  • 2021-11-04
  • 2021-06-18
猜你喜欢
  • 2022-12-23
  • 2021-07-03
  • 2021-09-11
  • 2021-07-22
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案