How can I get returning data from jquery ajax request?

Posted by Oguz on Stack Overflow See other posts from Stack Overflow or by Oguz
Published on 2010-05-25T04:40:30Z Indexed on 2010/05/25 4:51 UTC
Read the original article Hit count: 265

Filed under:
|
|
|
function isNewUsername(str){
    var result;
    $.post('/api/isnewusername', 
            {username:str},
            function(data) {
                result = data.result;
            }, 
            "json");
    return result;
}

So , my problem is very simple but I can not figure it out . I want to access result from the isnewusername function . I am very curious about answer because I spent 1 hour on it . Thank you

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery