All pastes #232760 Raw Edit

Stuff

public text v1 · immutable
·published 2006-11-01 14:56 UTC
rendered paste body
AJAX on helppoa


ENSIKSI SIMPPELI
OLION LUOMINEN:

  var XMLHttp=null
  try
  {
    XMLHttp=new ActiveXObject("Msxml2.XMLHTTP")
  }
  catch(e)
  {
    try
    {
      XMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    }
    catch(e) {}
  }
  
  if (XMLHttp==null)
    {
      XMLHttp=new XMLHttpRequest()
    }



OLIOLLA VOI TODELLA HELPOSTI LUKEA SIVUN:

  var curDateTime = new Date(); 
  http[curDateTime] = createRequestObject(); 
             
  http[curDateTime].open('get', $myUrl);
             
  http[curDateTime].onreadystatechange = function(){ 
    if (http[curDateTime].readyState != null && ( http[curDateTime].readyState == 4 || http[curDateTime].readyState == "complete")) 
      { 
	if (http[curDateTime].status == 200 || http[curDateTime].status == 304) 
	  { 
	    var response = http[curDateTime].responseText; 
	    document.getElementById('view_ajax').innerHTML = response; 
	  } 
      } 
  } 
  
  http[curDateTime].send(null);