score:1

Accepted answer

A callback function can't return anything because the point of the callback functions is that you don't wait for the return, so your callback function should implement your logic, something like that,

function getUsers() {
    jQuery.getJSON('http://127.0.0.1:8000/members', function(allUsers) {
        if(allUsers) {
            // you have allUsers here
            // you can do whatever your logic requires here
        }
    });
}

getUsers();

Related Query