title: How can I get a redirected URL from an AJAX Query?
body: <p>So, I'm trying to figure out how I can determine if a PHP script redirects in the middle of an AJAX call. Anyone know whether or not JQuery AJAX is aware of/tracks location changes?</p>
  
  <p>The scenario would be something like this...</p>
  
  <pre><code>function createOrder()
  {
      var contentRequest = $.ajax({
          url     : '/orders/create',
          method  : 'POST',
          data    : '',
          success : function( data, status, xhr ) 
          {       
              // Detect the header change in 'create.php' here,
              // perhaps update the history/current url.
          }
  };
  </code></pre>
  
  <p>create.php</p>
  
  <pre><code>&lt;?php
  $NewOrder = Order::CreateNew();
  
  header("Location: /orders/edit?orderID=$NewOrder-&gt;ID");
  ?&gt;
  </code></pre>