function XMLHTTPObj() { if(window.ActiveXObject) { try{ return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try {  return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e1) { return null; } } } else if(window.XMLHttpRequest) { return new XMLHttpRequest(); } else { return null; } } function ajaxRequest(curPage, afterFunction) { var xmlRequest = XMLHTTPObj(); if (xmlRequest != null) { xmlRequest.open("GET", curPage, true); xmlRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlRequest.setRequestHeader("Cache-Control","no-cache, must-revalidate"); xmlRequest.setRequestHeader("Pragma","no-cache"); if (afterFunction != null) { xmlRequest.onreadystatechange = function() { ajaxCallBack(xmlRequest, afterFunction); }; } xmlRequest.send(null); } } function ajaxCallBack(xmlRequest, afterFunction) { if (xmlRequest == null || xmlRequest.readyState != 4) return; if (afterFunction != null) { afterFunction(xmlRequest.responseText); } }