Public paste
Undefined
By: coolpet | Date: Mar 31 2010 18:21 | Format: None | Expires: never | Size: 1.25 KB | Hits: 943

  1. /********************************************************************************************************************
  2.         Ajax script for I-look
  3.         Created at: 2010.03.30
  4.         Created by: Coolpet
  5.         History:
  6.           2010-03-30 Created with easy data management
  7. ********************************************************************************************************************/
  8.  
  9. var xmlhttp;
  10. var ajaxResponse;
  11.  
  12. function ajaxRequest(data) {
  13.  
  14.         //Getting XmlHttp object
  15.         if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();                                      // code for IE7+, Firefox, Chrome, Opera, Safari
  16.         if (window.ActiveXObject) xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
  17.         if (xmlhttp==null) alert ("Your browser does not support XMLHTTP!");
  18.  
  19.         var url;
  20.         url = "somemagicintheair.php";
  21.         url=url+"?"+data;
  22.         url=url+"&sid="+Math.random();
  23.         xmlhttp.open("GET",url,false);
  24.         xmlhttp.send(null);
  25.         xmlhttp.onreadystatechange = stateChanged();
  26.  
  27. }
  28.  
  29. function stateChanged() {
  30.         //State Description
  31.         //0             The request is not initialized
  32.         //1             The request has been set up
  33.         //2             The request has been sent
  34.         //3             The request is in process
  35.         //4             The request is complete
  36.  
  37.         if (xmlhttp.readyState==4)  {
  38.                 ajaxResponse = xmlhttp.responseText;
  39.                 return(ajaxResponse);
  40.         }
  41. }