What aged in jQuery · 7 of 8

A handler for every endpoint

Ten interactive elements, ten handlers that bind, serialize, request, render and recover. The pattern is so regular it belongs in the markup.

Why it made sense

jQuery made AJAX approachable, and wiring each request by hand was the natural way to use it when a page had one or two.

What changed

On a page with dozens of interactions, the wiring dwarfs the logic, lives far from the HTML it affects, and is where bugs hide: a forgotten preventDefault, a stale selector after a redesign, an unescaped string. The htmx project popularised the alternative: let HTML describe the request and let the server return HTML.

What jsKjs does instead

Hyper reads kj-get/kj-post/kj-put/kj-patch/kj-delete, kj-target, kj-swap and kj-trigger and does the wiring for you, including content added later. You keep $.ajax for the cases that genuinely need code.

jQuery

JavaScript
$('#subscribe').on('submit', function (e) {
  e.preventDefault();
  $.post('/subscribe', $(this).serialize())
    .done(function (html) { $('#msg').html(html); })
    .fail(function () { $('#msg').text('Something went wrong'); });
});

jsKjs

HTML
<form kj-post="/subscribe" kj-target="#msg">…</form>
<p id="msg" aria-live="polite"></p>

Sources