title: PHP force download not working?
body: <p>On my HTML page I have made a JQuery ajax request to a php script that should force a download, but nothing is happening?</p>
  
  <p>On my html page (in click event handler for a link)...</p>
  
  <pre><code>var file = "uploads/test.css";
  $.ajax(
  {
      type      : "POST",
      url       : "utils/Download_File.php",
      data      : {"file":file}
  })
  </code></pre>
  
  <p>And the Download_File.php script looks like this</p>
  
  <pre><code>&lt;?php
  
  Download_File::download();
  
  class Download_File
  {
      public static function download()
      {
          $file = $_POST['file'];
  
          header('Content-Type: application/octet-stream');
          header('Content-Disposition: attachment');
          readfile('http://localhost/myapp/' . $file);
          exit;
      }
  }
  ?&gt;
  </code></pre>
  
  <p>But nothing is happening for some reason? I looked at the response headers in firebug and cant see any problems. Im using Xampp. Any help is much appreciated.</p>
  
  <p>Thanks!</p>