title: ajax xhr.status = 0 errors after reload / refresh, how to prevent it?
body: <p>I am running multiple ajax requests on a page, there is nothing wrong with the codes that I know of.  It is just that when an ajax call is till running and the user chooses to hit reload or refresh, the browser will return an status error 0, in both ff3 and chrome 14 (IE6+ does not have this problem).  </p>
  
  <p>Since I have many request, the browser will alert multiple times and can be very annoying.  I have read that this is a mozilla / firefox 3 bug, and it might have been fixed in later versions of ff, but chrome 14 apparently still has this error.  But I am building for ff3 and chrome compatibility.  There is a bug report seen  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=488605" rel="nofollow">Here</a></p>
  
  <p>Does anyone know how to suppress the status error for reload / refresh only? </p>
  
  <p>TIA</p>
  
  <p>my ajax codes</p>
  
  <pre><code>function createXHR() {
      var xhrObj;
      if (window.XMLHttpRequest) {
          // branch for native XMLHttpRequest object - Mozilla, IE7
          try {
              xhrObj = new XMLHttpRequest();
          } 
          catch (e) {
              alert("Your browser does not support this website!");
              xhrObj = null;
          }//close catche
      }  //close if
      else if (window.ActiveXObject) {
          // branch for IE/Windows ActiveX version
          try {
              xhrObj = new ActiveXObject("Msxml2.XMLHTTP");
          } //try
          catch(e) {
              try{
                  xhrObj = new ActiveXObject("Microsoft.XMLHTTP");
              }//inner try
              catch(e) {
                  alert("Your browser does not support this website!");
                  xhrObj = null;
              } //inner catch
          }//catch
      } //else if
  
      return xhrObj;
  }//eof createXHR
  
  function search(var1, var2) {
      var xhrObj = createXHR();
      if (xhrObj) {
          try {
      var queryString = "whatever";   
          xhrObj.open("GET", "url.php"+queryString,true);             
          xhrObj.onreadystatechange = function (){callback(xhrObj,var1,var2);};
          xhrObj.send(null);
          } catch (e) {
              alert ('search error');
              return;
          }
      } else {
         alert("search error has occured, please refresh and try again");
         return; //do plan B. You do have a plan B, no?
      }
  }//tld close
  
  function callback(xhr,var1, var2) { 
      if (xhr.readyState == 4) {
          try { 
              if (xhr.status == 200) 
                  {
          var s = xhr.responseText;           
                  //dosomething
                  }
              else {
                  alert('Status error '+xhr.status);
          return; 
          }
          } 
          catch (e) {
              alert("live Server Error "); 
          return;
          //this will alert if a call is issued to a nonexistent function / variable
          }
      }
  }//callback close
  </code></pre>