Promises and Deferreds
AJAX methods return a jqXHR with done, fail and always. Newer code can use native fetch or wrap in a real Promise.
Example
$.get('/api').done(show).fail(oops).always(hideSpinner);
fetch('/api').then((r) => r.json()).then(show);Exercise
Always runs.
$.get(u).(fn)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.