The Hot ajax

Famous of web2.0, the script language pushed the web forward based on ajax technology.
Currently,many ajax frameworks can be  used, such as dojo,sajax,dwr.....
But I insist on coding that by myself.


var request;
function createRequest(){
 try{
  request = new XMLHttpRequest();
 } catch (e){
  try{
   request = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try{
    request = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (e){
    alert("Your browser broke!");
    return false;
   }
  }
 }
 return request;
}

function ajaxRNTMP(phpurl,stuffid,idget1,idget2,idget3,idget4,idget5,idget6,idget7){
 
  model=getChangeValue(idget1);
  table=getChangeValue(idget2);
  datestart = document.getElementById(idget3).value;
  dateend = document.getElementById(idget4).value;
  ratio=getChangeValue(idget5);
  loc=getChangeValue(idget6);
  param=getChangeValue(idget7);
   //TODO : Validate form
  if(param==null || param==''){
     alert('Sorry,Please select paramerter!');
     return;
  }
  
  removePlot(stuffid,'ld');
  addElement();
  createRequest();
  querystring = "?model="+model+"&table="+table+"&datestart="+datestart+"&dateend="+dateend+"&ratio="+ratio+"&location="+loc+"&param="+param;
   
  request.open("GET", phpurl+querystring, true);
 request.onreadystatechange =function(){
  if(request.readyState == 4){
   if (request.status == 200){
   removeElement();
   ajaxDisplay = document.getElementById(stuffid);
   loading=document.createElement('img');
   loading.setAttribute('src',phpurl+querystring);
   loading.setAttribute('id', 'ld');
   ajaxDisplay.appendChild(loading);
   }
  }
 };
 request.send(null);
}

你可能感兴趣的:(Ajax,Web,Microsoft,DWR,dojo)