The function passed to $.post is a callback, meaning execution
continues in the main thread of operation until $.post returns, at
which point the callback function is executed.  To make your 2nd post
command wait until after the first is completed, your second post
command should be part of your callback function to the first post.
I.E. your code should be more like:

alert('start');
$.post("ajax.asp", { email: email },
            function(data){
                alert("Data Loaded: " + data);
               $.post("path.asp", { email: email }, validateReturn);
                alert('after');
            });

alert('continuing. . .')

this should produce:
start
continuing. . .
Data Loaded:. . .
after. . .

On Sep 7, 11:11 am, Christian <[EMAIL PROTECTED]> wrote:
> I have a little problem with the following code,
>
> alert('start');
> $.post("ajax.asp", { email: email },
>             function(data){
>                 alert("Data Loaded: " + data);
>             });
>
> // should wait until Data Loaded
> alert('start2');
>
> $.post("path.asp", { email: email }, validateReturn)
>
> alert('after');
>
> Output is:
> start
> start2
> after
> Data Loaded ...
>
> I have to call a $.post function twice. How can I do it, that the next
> $.post function have to wait until the first function is called and
> the output is processed?
>
> Bye

Reply via email to