What aged in jQuery · 3 of 8

jqXHR and the almost-promise

jQuery invented its own promise before JavaScript had one. Native Promises, fetch and async/await have long since replaced it.

Why it made sense

jQuery's Deferred (2011) introduced many developers to promises at all, and jqXHR wrapped XMLHttpRequest so callbacks and chaining felt natural years before fetch existed.

What changed

Deferreds only became Promises/A+ compliant in jQuery 3.0, and the 4.0 slim build drops Deferreds and Callbacks entirely, noting that native Promises cover most uses. jqXHR is still built on XMLHttpRequest, so cancellation, streaming and the Request/Response objects that the rest of the platform — service workers, the Cache API — speaks are all outside its model.

What jsKjs does instead

jsKjs's $.ajax is fetch underneath and returns a native Promise. await and try/catch just work; timeouts use AbortController; errors carry .status and the parsed body. For migration, success/error callbacks and .done()/.fail()/.always() are still accepted — without the "unhandled rejection" noise.

jQuery

JavaScript
$.ajax({ url: '/api/user', dataType: 'json' })
  .done(function (user) { render(user); })
  .fail(function (xhr) { alert(xhr.status); });

jsKjs

JavaScript
try {
  render(await $.getJSON('/api/user'));
} catch (err) {
  alert(err.status);
}

Sources