Thursday, 19 September 2013

How to return from AJAX wrapper function

How to return from AJAX wrapper function

var wrapper = function() {
var condition; //boolean
$.get('url', function(data) {
console.log(data); //url
condition = true/false;
});
return condition;
}
when I do wrapper() it returns always undefined because of async nature of
$.get. How to I solve this issue?

No comments:

Post a Comment