⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ajax.js

📁 用来在地图上做操作GIS,在地图上做标记
💻 JS
字号:
//AJAX

function createXMLHttpRequest(){
var XMLHttpReq = false;
  //请求对象
  if(window.XMLHttpRequest){
    XMLHttpReq=new XMLHttpRequest();
  }
  else if(window.ActiveXObject){
    try{
      XMLHttpReq =new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  if(!XMLHttpReq){
    alert("创建对象失败");
  }
  return XMLHttpReq;
}



//LED所有图层信息
/*function selectshuju()
{
  var XMLHttpReq=createXMLHttpRequest();
    //得到层的对象
   XMLHttpReq.onreadystatechange=Responsegongdong.
   XMLHttpReq.open("post","shenzhen.gis?database=deng",true);
   //xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
   XMLHttpReq.setRequestHeader('Content-type','application/x-www-form-urlencoded');
   //传参数
   XMLHttpReq.send("database=deng");
}*/


Function.prototype.setThis=function(){
  var curr_function = this;  
  var to_this_object = arguments[0];
  return function(){ 
    curr_function.apply(to_this_object, []);
  };
 }
 
 
 ////LED所有图层信息
function selecedLed(){
   var XMLHttpReq=createXMLHttpRequest();
   //得到设置回调函数的对象
   XMLHttpReq.onreadystatechange=ResponseHandler.setThis(XMLHttpReq);
   XMLHttpReq.open("post","ledInfo.do",true);
   //xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
   XMLHttpReq.setRequestHeader('Content-type','application/x-www-form-urlencoded');
   //传参数
   XMLHttpReq.send("method=findLedInfo"); 
}

 //分割字符串
 function splitstring(shenzhen, fuhao){
     return  shenzhen.split(fuhao); 
 }
  
  
 function  ResponseHandler(){
    if(4==this.readyState){
      if(200==this.status){
         alert(this.responseText);
          ceshi(this.responseText,neitherled);
        }else{
          alert("no")
       }
     }
   }




 /*function getHttpRequest(){
   http_request = null;  
   if (window.XMLHttpRequest) {    
     http_request = new XMLHttpRequest(); 
   }
    else if (window.ActiveXObject) { 
         http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
    }
    return http_request;
  }
  

 
 
 Function.prototype.setThis=function(){
  var curr_function = this;  
  var to_this_object = arguments[0];
  return function(){ 
     curr_function.apply(to_this_object, []);
  };
 }


function  getPerson(){  
  var tmp_request = getHttpRequest();  
  //建立一个http request 
   tmp_request.onstatechange = handleResponse.setThis(tmp_request);  //指定回调函数  
    
    tmp_request.open("GET", "shenzhen.gis?database=deng", null);  
     tmp_request.send(null);
    
   //tmp_request.open("post","shenzhen.gis",true);
   //xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  // tmp_request.setRequestHeader('Content-type','application/x-www-form-urlencoded');
   //传参数
   //tmp_request.send("database=deng");
   
} 


function handleResponse(){ 
   alert(this.readyState);
  if(this.readyState == 4){
   if(this.status == 200){  
     var xml = this.responseXML;
      alert(this.responseXML);
        
       /* 对获得的xml的处理 */  
 // }
  //}
//}


/*
 //AJAX

function createXMLHttpRequest(){
var XMLHttpReq = false;
  //请求对象
  if(window.XMLHttpRequest)
  {
    XMLHttpReq=new XMLHttpRequest();
  }
  else if(window.ActiveXObject)
  {
    try
    {
      XMLHttpReq =new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
      XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  if(!XMLHttpReq)
  {
    alert("创建对象失败");
  }
  return XMLHttpReq;
}


//LED所有图层信息
function selectshuju()
{
  var XMLHttpReq=createXMLHttpRequest();
    //得到层的对象
   XMLHttpReq.onreadystatechange=Responsegongdong.
   XMLHttpReq.open("post","shenzhen.gis?database=deng",true);
   //xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
   XMLHttpReq.setRequestHeader('Content-type','application/x-www-form-urlencoded');
   //传参数
   XMLHttpReq.send("database=deng");
}


Function.prototype.setThis=function(){
  var curr_function = this;  
  var to_this_object = arguments[0];
  return function(){ 
    curr_function.apply(to_this_object, []);
  };
 }
 
 
function disselectloadled(){
   var XMLHttpReq=createXMLHttpRequest();
   //得到层的对象
   XMLHttpReq.onreadystatechange=Responsegongdong.setThis(XMLHttpReq);
   XMLHttpReq.open("post","shenzhen.gis",true);
   //xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
   XMLHttpReq.setRequestHeader('Content-type','application/x-www-form-urlencoded');
   //传参数
   XMLHttpReq.send("database=deng"); 
}

  //分割字符串
  function splitstring(shenzhen, fuhao){
     return  shenzhen.split(fuhao); 
  }
  
  
function  Responsegongdong(){
    if(4==this.readyState){
      if(200==this.status){
            alert(this.responseText);
            //ceshi(XMLHttpReq.responseText);
        }else{
         alert("no")
       }
     }
   }



*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -