Skip to content
Justice Tech School

Promises and Deferred

Ajax returns a promise like object.

Example
$.ajax("/a").then(function (a) {
  return $.ajax("/b");
}).then(function (b) {
  console.log(b);
});
$.when($.ajax("/x"), $.ajax("/y")).done(function () {});

Exercise

Wait for many.

$.(a, b)

Quiz Test

What does $.when do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.