Basically I need to to return a variable from inside of a function using an ajax call.
Like so:
function returnStuff(){
$.ajax({
//do stuff
}).done(function(response){
return response;
})
return response;
}
I can't just use a variable in the done function and return that because the function will just return the undefined variable before the call completes.
Is there any way that I can return a variable through 2 layers of functions or is there a way that I can wait to return until the call is complete?