title: xmlhttprequest onlys gets to status 3
body: <p>I have a simple search form with a search box and a result box. </p>
  
  <p>When I type a search word a request is created like: <a href="http://www.site.com/php_handler.php?s=hello" rel="nofollow noreferrer">http://www.site.com/php_handler.php?s=hello</a>
  In the php script and a result is given back to the script this way: </p>
  
  <pre><code>&lt;?php return $s; ?&gt;
  </code></pre>
  
  <p>The problem is that my htmlrequest stops at readyState 3 it doesn't get to 4.</p>
  
  <p>The javascript looks like this:</p>
  
  <pre><code>var xmlhttp = sajax_init_object();
  
  function sajax_init_object() {
          var A;
          try {
              A=new ActiveXObject("Msxml2.XMLHTTP");
          } catch (e) {
              try {
                  A=new ActiveXObject("Microsoft.XMLHTTP");
              } catch (oc) {
                  A=null;
              }
          }
          if(!A &amp;&amp; typeof XMLHttpRequest != "undefined")
              A = new XMLHttpRequest();
          if (!A)
              sajax_debug("Could not create connection object.");
          return A;
      }
  function getSearchItem()
    {
          gs=document.forms.mainform.resultsfield;
          var searchword=document.forms.mainform.searchform.value;
          if (searchword.length&gt;=3)
          {
          setWaitCursor();
          clearResults();
          var uri = "http://site.com/ajax_handler.php?s="+searchword;
          console.log(uri);
          xmlhttp.open("GET", uri, true);
          xmlhttp.onreadystatechange=function() 
          {
  
          if (xmlhttp.readyState==4) {
            processResults(xmlhttp.responseText);
                  removeWaitCursor();
          }else{
              console.log(xmlhttp.readyState);
          }
        }
        xmlhttp.send(null);
      }
      else
      {
        alert("please add at least 3 characters ."); 
      }    
    }
  </code></pre>
  
  <p>Can someone tell me why it stops at 3?</p>
  
  <p>edit: here is also the php code:</p>
  
  <pre><code>&lt;?php
  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  header("Cache-Control: no-store, no-cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", false);
  header("Pragma: no-cache");
  
  session_start();
  
  
  //include main file
  require_once($_SESSION["FILEROOT"] . "xsite/init.php");
  
  //check if formulier is posted
  
  $zoekterm = C_GPC::getGETVar("s");
  $s="";
  
  if ($zoekterm != "") {
      $query="SELECT number,name,city,zib,zip_annex FROM articles WHERE version='edit' AND (naam LIKE '%$school%' OR brinnummer='$school')  ORDER BY name";
      if ($rs=C_DB::fetchRecordSet($query)) {
          while ($row=C_DB::fetchRow($rs)) {
              if ($row["plaats"]!="") {
                  $s.=$row["name"].", ".$row["city"]."|".$row["number"]."\n";
              } else {
                  $s.=$row["name"].", ".$row["zip"].$row["zip_annex"]."|".$row["number"]."\n";
              }
          }
      }
  }
  
  return $s;
  
  
  ?&gt; 
  </code></pre>
  
  <p>edit:</p>
  
  <p><strong>I missed a semicolon in my php script and now the ready state only gets to 2</strong></p>
  
  <p>edit:</p>
  
  <p><strong>The problem is even different. It gets to 4 but it doesn't show the result text.</strong></p>