function createXMLHttpRequest() {
    //判断浏览器是否支持ActiveX控件
    if (window.ActiveXObject) {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
    }
}
function doRequest(url) {
    //调用方法，返回地址
    
    createXMLHttpRequest();		
    var queryString = url;
    xhr.onreadystatechange = handleStateChange;//当XMLHttpRequest的readyState属性改变的时候
    xhr.open("POST", queryString, true);
    xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
    xhr.setRequestHeader ("Cache-Control","no-cache");
    //xhr.setRequestHeader( 'If-Modified-Since', 'Thu, 06 Apr 2006 01:00:00 GMT' );
    
    xhr.send(queryString);
}
function handleStateChange() {
    if(xhr.readyState == 4) {   
        if(xhr.status == 200) {
       
            parseResults();
        }
        if(xhr.status == 12030 || xhr.status == 12031){ 
        }
    }
}

function parseResults() {
    var responseDiv = document.getElementById("serverResponse");
    if(xhr.responseText==null)
        alert("xhr.responseText is null");
    else
        responseDiv.innerHTML = xhr.responseText;
}