How can I get returned value from JavaScript function that contain jQuery.get() ?

Posted by Space Cracker on Stack Overflow See other posts from Stack Overflow or by Space Cracker
Published on 2010-05-15T09:05:16Z Indexed on 2010/05/15 9:14 UTC
Read the original article Hit count: 116

Filed under:
|

I have a JavaScript method that call JQuery.get() and i want to return value from itto callee function .. the following is the code :

function CheckExistance(userName) {
        $.get(
            "JQueryPage.aspx", { name: userName },
             function(result) {
                 if (result == "1") {
                     value = true;
                 }
                 else if (result == "0") {
                     value = false;
                 }
                 else if (result == "error") {
                     value = false;
                 }
             }
        );                
        return value;
    }

i want return value; return the value setted in get() function ... i know that get() is asynchronous operation anf i want a solution to do that ?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery