Hi,
Today i upgrade my jQuery library from 1.3.2 to 1.4.2. Everything works fine just this small thing looks broken, here is a simple testcase.
I have page "a.php"
On this page i'm doing ajax POST request.
- jQuery.ajax({
- type: 'POST',
- data: {'a':7},
- url: 'b.php',
- success: function(){alert('b')},
- error: function(){alert('c')}
- });
On page "b.php" I'm redirecting on page "b.php" (yes strange but it's necessary, company framework etc...).
here is b.php
- session_start();
- if(!isset($_SESSION['a'])){ / first POST request
- $_SESSION['a']=1;
- header('Location: b.php');
- }
- else{ // second get request
- sleep(10);
- unset($_SESSION['a']);
- echo "aaaaaaaa";
- }
So the workflow is
a.php -> POST(ajax request) -> b.php -> GET(redirect) ->b.php and there is a problem.
jQuery don't call callbacks, nor success nor error.
If i modifi b.php in this way
- <?php
- session_start();
- if(!isset($_SESSION['a'])){
- $_SESSION['a']=1;
- header('Location: b.php?'.time()); // url is sligtly diferent everything is working
- }
- else{
- sleep(10);
- unset($_SESSION['a']);
- echo "aaaaaaaa";
- }
everything is fine.
Can somebody help me?
Thanks
EDIT 1:
Today i have found out that problem is only with async:true, so using async:false is workaround.
EDIT 2:
Here is a simple testcase
http://rstest.ic.cz/js/When you click on click Button, the ajax is fired but success calback is never called