function ajax(url, onsuccess, onfail) {
    var xmlHttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
    xmlHttp.open("POST", url, true);
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200) {
                onsuccess(xmlHttp.responseText);
            }
            else {
                onfail(xmlHttp.status);
            }
        }
    }
    xmlHttp.send();
}

相关文章:

  • 2022-02-13
  • 2022-12-23
  • 2021-11-27
  • 2021-09-30
  • 2022-12-23
  • 2021-07-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2022-01-30
相关资源
相似解决方案