how to get a asynchronous return value from a ajax callback

how to get a asynchronous return value from a ajax callback


Hi everyone,
here is my problem:
I would like to get a return value of test() given by the callback
function.
The problem I have is because the scope of the callback doesn't
interact with the test function so I'm not able to interact between
them.
here is my function:
Code:
function test(){
$.ajax({
type: "POST",
url:"/ajax/test/",
data: { ...]
dataType: "json",
success: function(data){
return true;
}
});
}
}
How would be possible to get the return value of the callback function
in test() function in order to make something like:
Code:
function test(){
return $.ajax({
type: "POST",
url:"/ajax/test/",
data: { ...}
dataType: "json",
success: function(data){
return true;
}
});
}
}
In advance thanks