title: JQuery $.ajax "async: false" bug?
body: <p>I would appreciate your opinion/advice on the following</p>
  
  <p><strong>Scenario</strong> </p>
  
  <p>HTML has PDF file nick name, back end has URL for each nick. </p>
  
  <p>The link URL is always <code>download.php?what=%PDF_Nick%</code> to ensure download for JS disabled clients. </p>
  
  <p>For JS enabled clients I do JQuery AJAX call and rewrite link URL from <code>download.php?what=%PDF_Nick%</code> to <a href="http://examplesite.com/requestedPFF.pdf" rel="nofollow noreferrer">http://examplesite.com/requestedPFF.pdf</a> to activate download from the client. I set <code>"async: false"</code> to allow AJAX get new url.</p>
  
  <p><strong>Problem</strong></p>
  
  <p>AJAX returns valid script rewriting JS url variable, but <code>location.href</code> runs again to the initial url, creating extra back end call</p>
  
  <p>Do you think it's related to the bug ignoring <code>"async: false,"</code> definition or it's mistake I've made and missed to catch?</p>
  
  <p>Thank you in advance</p>
  
  <h1>HTML code</h1>
  
  <pre><code>
      &lt;a href="/download.php?what=PDF_A" onclick="javascript:download
      ('PDF_A')"&gt;Download&lt;/a&gt;
  
  </code></pre>
  
  <h1>JS code</h1>
  
  <pre><code>function download ( what )  {
  
     var url = "download.php?what="+what;
  
     $.ajax({
        type: "GET",
        url: "download.php?ajax=true",
        data: "what=" + what
        async: false,
        dataType: "script"
    });
  
    // if AJAX got the download URL I expect actual download to start:
    location.href = url;
  }
  </code></pre>
  
  <h1>Back end (download.php) code</h1>
  
  <pre><code>$myPDF = array();
  $myPDF["PDF_A"] = "PDF_A.pdf";
  ....
  $url = "http://examplesite.com/" . $myPDF["PDF_A"];
  ...
  if ( $_GET["ajax"] === "true" ) {
      // overwrite JS url variable
      print('url = "'.$url.'";');
  } else {
      header("Location: ". $url );
      header("Connection: close");
  }
  </code></pre>