[jQuery] simple ajax question

[jQuery] simple ajax question


I have a small ajax issue here:
function someFunc(){
var someVar = true;
    $.ajax({
     type: "GET",
     url: requestURL,
     success: function(msg){
         ....
     }
    });    
}
I have 2 problems:
1. I want someFunc to return a value according to the result of the ajax
request - e.g. if msg is empty to return true, otherwise false. But if I
attempt to return something, actually the function(msg) returns it somewhere
and I don't get any result, which is logical since I'm inside an anonymous
function like function(msg). So i try to assign this variable someVar and
then return it like:
    
url: requestURL,
success: function(msg){
someVar = false;
}
});
return someVar;
but it returns true... i suppose someVar is returned before the request is
completed... so I don't know what to do? Any suggestions?
--
View this message in context: http://www.nabble.com/simple-ajax-question-tp14833721s27240p14833721.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.