I have a javascript function inside which i have two $.post requests.Both the $.post requests should get executed.But sometimes,second $.post request doesn\'t get executed.W
$.post()
is an abbreviated form of the $.ajax() structure. I usually prefer to use the $.ajax()
structure because:
asynch: false,
In your case, you might find your problem easier to solve in a $.ajax()
structure, since it would be easier to see that a second ajax call (that depends on the outcome of a first ajax call) must happen in the success function of the first ajax call.
Here is a standalone example (too bad jsFiddle cannot handle ajax...):
TESTER.PHP
Email:
Password:
yourphpfile.php
Here is something new';
echo $n;
}