The $.getJSON callback function is not called at the time you make the
$.getJSON call. It's called asynchronously, much later, after the data has
been downloaded. The return value from the callback is discarded - there's
no one to return it to.

Did you want to take two different actions depending on the value of
res.registed? Then do it right there in the callback. For example:

        $.getJSON(url, function(res){
                if(res.registed){
                        doOneThing();
                }else{
                        doAnotherThing();
                }
        });

-Mike

> -----Original Message-----
> From: jquery-en@googlegroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of Freshow
> Sent: Thursday, November 13, 2008 7:58 AM
> To: jQuery (English)
> Subject: [jQuery] How can I return some value in jquery's 
> callback function?
> 
> 
> it didn't work when I 'return true' or 'return false', is 
> there some way to get it?
> ==============================================================
> var url='http://localhost/coudou/check/register.php?email=' + str;
>       $.getJSON(url, function(res){
>               if(res.registed){
>                       return true;  // not work
>               }else{
>                       return false; // not work
>               }
>       });
> 

Reply via email to