日期:2014-05-17 浏览次数:20452 次
function createXMLHttpRequest() { var xmlHttp = null; if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP") } if (xmlHttp == null) return data = "a=1&b=1" xmlHttp.onreadystatechange = handleStateChange; xmlHttp.open("POST", "simpleResponse.ashx?tmp=" + (new Date()).valueOf(), true); xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp.setRequestHeader("Content-length", data.length); xmlHttp.setRequestHeader("Connection", "close"); xmlHttp.send(data); } function handleStateChange() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { alert(xmlHttp.responseText); } } }