UJS doesn't really have much to do with the on
function. That's provided by jQuery, and it takes multiple forms. UJS simply fires the ajax:complete
event so you can hook into it yourself.
The selector
argument is optional, so both
$(...).on("ajax:complete", function(xhr, status) { ... }
and
$(...).on("ajax:complete", "form", function(xhr, status) { ... }
are valid uses, though they work somewhat differently.