==========================================================================================================
function createXMLHttpRequest(){
if(window.XMLHttpRequest){
return new XMLHttpRequest();
}else if(window.ActiveXObject){
var versions = ["MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];
for(var i = 0; i < versions.length; i++){
try{
var ieXmlHttp = new ActiveXObject(versions[i]);
return ieXmlHttp;
}catch(Error){throw new Error("create XMLHttp faile!!!!");}
}
}
throw new Error("create XMLHttp faile!");
}
==========================================================================================================
var XMLHttpReq = null;
function sendRequest(url) {
XMLHttpReq = createXMLHttpRequest();
XMLHttpReq.open("GET", url, true);
XMLHttpReq.onreadystatechange = processResponse;
XMLHttpReq.send(null);
}
==========================================================================================================
function processResponse() {
if (XMLHttpReq.readyState == 4) {
if (XMLHttpReq.status == 200) {
var res=XMLHttpReq.responseText;
window.alert(res);
} else {
window.alert("fail");
}
}
}
==========================================================================================================
function sendUrl()
{
var usernameText = document.getElementById("username").value;
var passwordText = document.getElementById("password").value;
//window.alert(usernameText);
sendRequest("login.do?uname="+usernameText+"&upass="+passwordText+"");
}