34 lines
1,006 B
HTML
34 lines
1,006 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title id="page-title">HTMX Demos</title>
|
|
<script src="htmx-1-9-12.min.js"></script>
|
|
<link rel="stylesheet" href="styles.css"/>
|
|
</head>
|
|
<body>
|
|
<h1 id="title">Demo</h1>
|
|
<h2>Using history with <code>hx-push-url</code></h2>
|
|
|
|
<nav hx-get="/autonum/nav" hx-trigger="load"></nav>
|
|
|
|
<div id="main">
|
|
<label for="search">Search Contacts:</label>
|
|
<input id="search" name="q" type="search" placeholder="Search Contacts">
|
|
<button hx-get="/search"
|
|
hx-target="#main .results"
|
|
hx-include="#search"
|
|
hx-push-url="true"
|
|
>
|
|
Search The Contacts
|
|
</button>
|
|
<div class="results"></div>
|
|
<p>Usage:</p>
|
|
<ul>
|
|
<li>search on some criteria a couple of times,</li>
|
|
<li>then use the browser ←/→ buttons button. Yay ! 😊</li>
|
|
<li>Now refresh the page. Boo 😕 : we get only the partial response, because the pushed URL is the one for the <code>hx-post</code></li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|