jquery ajax callback out of the function scope

Posted by vasion on Stack Overflow See other posts from Stack Overflow or by vasion
Published on 2010-04-22T15:04:48Z Indexed on 2010/04/22 15:53 UTC
Read the original article Hit count: 229

Filed under:
|
function checkauth(){
       jQuery.getJSON("/users/checkauthjson", null, function(xhr){
           if(xhr.success){ return true;}else{ return false;}
            });
   }

Obviously, that does not work, but it illustrates what i want to achieve. I want checkauth to return a value which is checked against an ajax server script.

How do i do this?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX