title: Open PHP file using AJAX
body: <p>i am trying to execute a PHP file using AJAX, which is supposed to update a txt file</p>
  
  <p>here is my javascript</p>
  
  <pre><code>    function getXMLHttp()
      {
        var xmlHttp
  
    try
    {
      //Firefox, Opera 8.0+, Safari
      xmlHttp = new XMLHttpRequest();
    }
    catch(e)
    {
      //Internet Explorer
      try
      {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch(e)
      {
        try
        {
          xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e)
        {
          alert("Your browser does not support AJAX!")
          return false;
        }
      }
    }
    return xmlHttp;
  }
  
  
  
  function MakeRequest()
  {
    var xmlHttp = getXMLHttp();
    var host = window.location.hostname;
    var dir1=window.location.pathname.split("/")[1];
    var dir2=window.location.pathname.split("/")[2];
    var p = document.getElementById(\'CTI_IP\').value;
    var url=\'http://\'+host+\'/\'+dir1+\'/modules/company/include/file.php?var=\'+p;
    xmlHttp.open("POST",url,true);
    if (xmlHttp.readyState==4) 
   {
    xmlHttp.send();
   }
  }
  </code></pre>
  
  <p></p>
  
  <p>the url is fine, i alerted it, copy pasted the link, the php file is working perfect and updating the txt file but it won't work in ajax? why</p>
  
  <p>thanks !!</p>