$.post returns immediately. It does not wait for the data to be downloaded.
There is an option to force it to wait, but that is definitely not
recommend, since it locks up the browser (and *all* browser sessions from
the same browser instance) while waiting.

The callback function is where you put code that should run after the data
is returned.

To sequence your two posts properly, code it like this:

    $.post("ajax.asp", { email: email },
        function(data){
            $.post("path.asp", { email: email }, validateReturn);
        });
    
-Mike 

> -----Original Message-----
> From: jquery-en@googlegroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of Christian
> Sent: Sunday, September 07, 2008 11:11 AM
> To: jQuery (English)
> Subject: [jQuery] $.post - timing problem
> 
> 
> 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