> Michael Geary wrote:
> > You're still expecting things to happen in the wrong order. 
> > It's *inside the callback* that the data becomes available, 
> > and this is long after isTracked() returns.

> From: [EMAIL PROTECTED]
> Yes, but I want have a function that will return what i get from
> istracked.php to use it like that:
> 
> function isTracked(...)
> {
>  $.get('istracked.php',...);
> return value_from_istrackedphp
> }
> //and then
> 
> if (isTracked(...)=='true')
>   //thing A
> else
>    //thing B
> 

The only way to do that is to use a synchronous $.ajax call:

http://docs.jquery.com/Ajax/jQuery.ajax#options

But beware! This has the extremely negative effect of completely locking up the 
browser window - and all other browser windows in
many browsers - until your server returns the ajax data.

Do you want to do this this merely for coding convenience, or is there an 
actual reason that your code *has* to work this way? If
it's just for convenience, I strongly recommend using a callback function 
instead. But if there's a real need for it, the
synchronous $.ajax will do the trick.

-Mike

Reply via email to