PHP与Ajax调用

var url = "../IPSearch.php";//要发送到的URL
    //alert(document.getElementById("DepCode").value);
    //alert(document.getElementById("QueryType").value);
    var queryString ="DeptCode"+ "=" +DeptCode;
    queryString+= "&QueryType" + "=" + QueryType;//如果有多个参数需要传递,则用&符号连接
    xmlHttp.open("post", url, true);

    xmlHttp.onreadystatechange = showIPSearchResult;
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
    xmlHttp.send(queryString);

原文地址:https://www.cnblogs.com/GarfieldTom/p/1496313.html