Posted by AFNedreN Wed 7th Mar 2007 21:17 - Syntax is None/text - 56 views
Download | New Post | Modify | Hide line numbers
  1.    var xmlHttp;
  2.    function checkPosts() {
  3.       xmlHttp = createRequestObject();
  4.       if (xmlHttp == null) {
  5.          alert('Sorry, your browser does not support xml HTTP requests.');
  6.          return false;
  7.       }
  8.       xmlHttp.open('POST', '../includes/javascript/lpStatus.php?', true);
  9.       xmlHttp.onreadystatechange = handleResponse;
  10.       xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  11.       xmlHttp.send('do=status');
  12.    }
  13.  
  14.    function handleResponse() {
  15.       var returnedString;
  16.       if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete') {
  17.          returnedString = xmlHttp.responseText;
  18.          if (returnedString != latestPostID) {
  19.             return true;
  20.          } else {
  21.             window.location = 'client.php';
  22.          }
  23.       }
  24.    }
  25.  
  26.    function createRequestObject() {
  27.       var object;
  28.       var browser = navigator.appName;
  29.       if(browser == 'Microsoft Internet Explorer'){
  30.          object = new ActiveXObject('Microsoft.XMLHTTP');
  31.       } else {
  32.          object = new XMLHttpRequest();
  33.       }
  34.       return object;
  35.    }

PermaLink to this entry https://pastebin.co.uk/11537
Posted by AFNedreN Wed 7th Mar 2007 21:17 - Syntax is None/text - 56 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0