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

当http.status为200,则成功,遇到几次等于500,均属代码问题。

04-23 10:00