/ Published in: jQuery
Basically, if the value has already been requested once before it's returned immediately from the cache. Otherwise, an AJAX request fetches the data and adds it to the cache. The $.when/.then doesn't care about any of this; all you need to be concerned about is using the response, which is passed to the .then() handler in both cases.
Deferreds are perfect for when the task may or may not operate asynchronously, and you want to abstract that condition out of the code.
Deferreds are perfect for when the task may or may not operate asynchronously, and you want to abstract that condition out of the code.
URL: http://stackoverflow.com/questions/4869609/how-can-jquery-deferred-be-used