⚡ Native Client Sync
Hypermedia-driven interactivity out of the box.
Crown includes built-in capabilities inspired by HTMX. You can update the DOM dynamically, handle form submissions, and create highly interactive experiences without writing a single line of JavaScript.
Fetching and Updating
Use crown-get to fetch HTML from an endpoint, and crown-target to specify which element's inner HTML should be replaced with the server response.
<button crown-get="/api/save" crown-target="#result">Fetch Data
</button><div id="result"><!-- The response from /api/save will be injected here -->
</div>
Form Submissions
You can also use crown-post on forms to intercept standard form submissions, send the data securely via AJAX, and update parts of the page transparently instead of triggering a full page reload.
<form crown-post="/api/save" crown-target="#form-msg"><input name="content" type="text" /><button type="submit">Submit</button></form><div id="form-msg"></div>