posts - 431,  comments - 344,  trackbacks - 0
var xmlHttp;
function createXMLHttpRequest(){
  if(window.ActiveXObject){
     try {
    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (e) {}
  }
   }else if(window.XMLHttpRequest){
     xmlHttp = new XMLHttpRequest();
  if (xmlHttp.overrideMimeType) {
    xmlHttp.overrideMimeType('text/xml');
   }
   }
   if (!xmlHttp) {
   window.alert("Could not create XMLHttpRequest.");
   return false;
   }
}
function startRequestGET(url,handleStateChange){
  createXMLHttpRequest();
  xmlHttp.onreadystatechange=handleStateChange;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function startRequestPOST(url,handleStateChange,data){
  createXMLHttpRequest();
  xmlHttp.onreadystatechange=handleStateChange;
  xmlHttp.open("POST",url,true);
  xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  xmlHttp.send(data);
}
posted on 2006-09-13 09:25 周锐 阅读(313) 评论(0)  编辑  收藏 所属分类: Ajax

只有注册用户登录后才能发表评论。


网站导航: