I've a small example to get data from the ajax response (directly).
class foo {
    get baz() {
        return this.bar();
    }
    test(func) {
        this.bar = function () {
            return 'baz';
        };
        let res = func().done(this.bar);
        return this;
    }
}
let func = function () {
    return $.ajax({ url: '/', type: 'GET' });
};
let f = new foo();
// try to make a request with ajax
let result = f.test(func);
// then, show the response
// no need to use callback function here
console.log(result.baz);<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>So, my question: is using callback inside ajax obsolete?
Everything I need to do: make a request, then, wait for the request completes and show the response.
This syntax is out:
let onSuccess = function () {};
let onError = function () {};
$.ajax({}).done(onSuccess).fail(onError);
UPDATE:
This code would return the target response:
get baz() {
    return this.bar ? this.bar() : undefined;
}
this.bar = function (res) {
    return res;
};
