title: ajax: no data from local server
body: <p>I'm using php on a linux machine. My html code issues an ajax request to the local apache server (<a href="http://localhost" rel="nofollow">http://localhost</a>), and the data from the server should be printed out on the screen. However, nothing gets printed.</p>
  
  <p>The code on the "client" side (the html file which I load in the browser) is:</p>
  
  <pre><code>&lt;html&gt; 
      &lt;body&gt;
          &lt;script language="javascript" type="text/javascript"&gt;
              function ajaxFunction(){
                  var ajaxRequest;  // The variable that makes Ajax possible!
  
                  try{
                      // Opera 8.0+, Firefox, Safari
                      ajaxRequest = new XMLHttpRequest();
                  } catch (e){
                      // Internet Explorer Browsers
                      try{
                          ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                      } catch (e) {
                          try{
                              ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                          } catch (e){
                              // Something went wrong
                              alert("Your browser broke!");
                              return false;
                          }
                      }
                  }
                  ajaxRequest.onreadystatechange = function(){
                      if( ajaxRequest.readyState == 4 ){
                          document.writeln( ajaxRequest.responseText );
                      }
                  }
                  ajaxRequest.open("GET", "http://localhost/s.php", true);
                  ajaxRequest.send(null); 
              }
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and the "server" script (which is /var/www/s.php) is:</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;?php
              echo date("H:i:s"); 
          ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any suggestions?</p>
  
  <p>TIA</p>