Daily Archives: December 1, 2017

JQuery – Deferred, then, Apply

One simple example on how to use

1
2
3
4
5
6
7
8
9
10
11
12
function getPromise() {
    var deferred = $.Deferred();
    deferred.resolve("Hello");
 
    return deferred.promise;
}
 
getPromise().then(
    function(data) {
        console.log(data); // output 'hello'
    }
);

will put JQuery Deferred-then-Apply source code analysis later on.