I was totally confused by the following situation...
situation
post data from a.php to b.php and redirect to b.php...but fail
CODE - a.php
<html>
  <head>
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script>
      $(document).ready(function() {
        $('#submit').click(function() {
          $.ajax({
            url: 'b.php',    
            dataType: 'html',
            type: 'POST',
            data: { 
              value: $('#value').val()
            },
            error: function(xhr) {
              console.log('ajax went wrong!');
            },
            success: function(response) {
              console.log(response);
              window.location.href = "b.php";      
            }
          });
        });
      });
    </script>
  </head>
  <body>
    value: <input type="text" id="value">
  </body>
</html>
CODE - b.php
<?php
  echo $_REQUEST['value'];
?>
a.php can get the right response from b.php without redirect function. However, once I include the statement window.location.href = "b.php";, a.php will redirect to b.php but without printing anything.
Why is this situation happening?
Is there any solution to fix this?
Thanks!