Ajax XMLHttpRequest

    习惯了jQuery之后,怎么写XMLHttpRequest都快忘了,真够晕的....


var xmlhttp;
function getxmlhttp(){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(faild)
	{
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(faild){
				try{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}catch(faild){
					xmlhttp=false;
				}
		}
	}
}
xmlhttp.onreadystatechange=updatePage();

function updatePage() {
   if (request.readyState == 4)
     if (request.status == 200)
       alert("Server is done!");



你可能感兴趣的:(java,jquery,Ajax,Microsoft)