{live 'name'}...{/live} makes a part of the page interactive without
JavaScript of the application's own. The content is wrapped in
<div data-pad-live="name">, and the first region of the page brings a small
inline script. Inside the region three attributes raise an event:
pad-click="event" on any element - a click;pad-submit="event" on a form - its fields come along as request values;pad-change="event" on a field - its name and value come along.pad-value="..." gives the event a value.
An event posts padLive, padEvent and padValue to
the page's own URL. The page runs as it always does - its PHP reads
padLiveEvent() and padLiveValue() and changes its data - and the
answer is the inner content of that one region, which the script swaps in. Nothing else of the
page is sent.
State lives where a page keeps it: the session (names listed in
$padSessionVars), a database, or the value the event carries, as the counter
example does with pad-value. With $padCsrf on, the region carries
the session's token in data-pad-csrf and the script sends it with every event.
Under the strict check a {live} without a name or without its closing tag is an
error, and so is an event posted for a region the page does not render. For a part that is
only loaded later, not re-rendered, see {ajax}; htmx and similar
libraries get the same partial answers through {fragment}.