{% extends "django_sample_components/pages/master_async.html" %} {% load async_tags sample_tags %} {% block title %}Async Lazy Popup{% endblock %} {% block content %}
Modal that fetches its content from the server only when opened.
Content is fetched only on the first open. Close and reopen — no new request:
Content is re-fetched every time the modal opens. Notice the timestamp updates:
The counter is fetched from the server only when the modal is opened:
The counter is rendered immediately as part of the page, even before the modal opens:
show.bs.modal event on the modal elementGET request to content_urlalways_reload_on_open=True
By default, content is fetched only once — after the first load, the HTMX
trigger element is removed from the DOM (hx-swap="outerHTML"), so no further
requests are made.
Set always_reload_on_open=True to re-fetch content every time
the modal opens. The trigger element persists (hx-swap="innerHTML") and fires
on each show.bs.modal event. Useful for live data that must always be fresh.