title: Opening webpage in Ajax and checking statues code
body: <p>I have a code that is supposed to check if a page is loaded and then alert me with a status.
  The code for some reason will not work.
  I would appreciate it if you can take a look at it and tell me what I did wrong.
  Looking foward to a answer!</p>
  
  <pre><code>var xmlHttp = createXmlHttpRequestObject();
  function createXmlHttpRequestObject(){
      var xmlHttp;
      if(window.ActiveXObject){
          try{
          xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  
          }catch(e){
          xmlHttp = false;
          }
      }else{
      try{
          xmlHttp = new XMLHttpRequest();
  
          }catch(e){
          xmlHttp = false;
          }
      }
      if(!xmlHttp){
          alert("Error");
      }
      else{
      return xmlHttp;
      }
  
  }
  function process(){
      if(xmlHttp.readyState==0 || xmlHttp.readyState==4){
          xmlHttp.open("GET", "djhgkjshgkjsd.com", true);
          xmlHttp.onreadystatechange = handleServerResponse;
      }
      else{
          setTimeout('process()', 1000);
      }
  }
  
  function handleServerResponse(){
      if(xmlHttp.readyState==4){
          if(xmlHttp.status==200){
              xmlResponse = xmlHttp.responseXML;
              alert("Hi..."); // This is just to test where my code fails
  
          }else{
              alert('Something is wrong!');
          }
      }
  
  }
  </code></pre>