日期:2014-05-16 浏览次数:20648 次
var xmlHttpRequest = false; function createXMLHttpRequest() { if (window.XMLHttpRequest) { xmlHttpRequest = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) { try { xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { xmlHttpRequest = false; } } } } function handleAjaxResult() { if (xmlHttpRequest.readyState == 4) { if (xmlHttpRequest.status == 200) { var responseStr = xmlHttpRequest.responseText; document.getElementById("checkName").innerHTML = responseStr; } else { } } } function executeAjaxCommand(){ createXMLHttpRequest(); var COM_Name=document.thisForm.COM_Name.value; var url = "/erm/checkName"; xmlHttpRequest.open("POST", url, true); //如果用GET会有缓存问题 xmlHttpRequest.setRequestHeader("content-type","application/x-www-form-urlencoded"); xmlHttpRequest.onreadystatechange = handleAjaxResult; xmlHttpRequest.send("COM_Name="+COM_Name); }
?