title: window.location seems to cancel ajax post request
body: <p>I am trying to send data to php with ajax and at the same time redirect to that php file but when I redirected to the php file, the ajax didn't seem to send the data. I wanted to achieve something wherein a button is clicked and a data is sent to php using ajax and at the same time redirect to that php file to see the data sent by displaying it. The reason I didn't use something like <code>window.location="ajaxtest.php?data=data"</code> is because I'm gonna be using it in a google map api wherein if I click a button of a place, then I will redirect to the maps page and display the marker of the specific place depending on the id the ajax sent to the php file and the coordinates generated based on that id.</p>
  
  <p>ajaxtest.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3
  /jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  
      $(document).ready(function(){
          $("#button").click(function(){
              var data = "test";
              $.post("ajaxtest.php",{
                   data: data
              },function(data, status){
                   window.location="ajaxtest.php";
              });
          });
      });
  
  &lt;/script&gt;
  
  &lt;button id="button"&gt;test&lt;/button&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>ajaxtest.php</p>
  
  <pre><code>&lt;?php  
  
  if(isset($_POST['data'])){
      echo $_POST['data'];
  }
  
  ?&gt;
  </code></pre>