//第一种 var xmlhttp = document.all ? new ActiveXObject("Microsoft.xmlhttp") : new XMLHttPRequest(); var Ajax={ "xmlhttp":xmlhttp, "get":function(url,execute){ xmlhttp.open("GET", url, true); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4 && xmlhttp.status==200) { execute(); } }; xmlhttp.send(null); }, "post":function(){} };
function invoke(){ var docheckuser=function(){ var val = xmlhttp.responseText; alert(xmlhttp.responseText); }; Ajax.get("checkUser.do?uname=zhangsan",docheckuser); }
//第二种 var xmlReq = document.all ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
var pre=""; function invoke(){ var url = arguments[0]; pre=arguments[1]; for(var n=0;n<arguments.length;n++){