Returning AJAX Data from Function?
I have the following function
-
function getAllUsers()
{
// make ajax request
$.ajax({
url: url,
type: "GET"
});
return data; // <---- i want to return data from ajax call
}
How in the world can i have my function return data from an ajax call asynchronously so that the above function can be used by a client/caller like so.
var userArray = getAllUsers();