08.html 1006 B

12345678910111213141516171819202122232425262728293031323334
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title id="page-title">HTMX Demos</title>
  6. <script src="htmx-1-9-12.min.js"></script>
  7. <link rel="stylesheet" href="styles.css"/>
  8. </head>
  9. <body>
  10. <h1 id="title">Demo</h1>
  11. <h2>Using history with <code>hx-push-url</code></h2>
  12. <nav hx-get="/autonum/nav" hx-trigger="load"></nav>
  13. <div id="main">
  14. <label for="search">Search Contacts:</label>
  15. <input id="search" name="q" type="search" placeholder="Search Contacts">
  16. <button hx-get="/search"
  17. hx-target="#main .results"
  18. hx-include="#search"
  19. hx-push-url="true"
  20. >
  21. Search The Contacts
  22. </button>
  23. <div class="results"></div>
  24. <p>Usage:</p>
  25. <ul>
  26. <li>search on some criteria a couple of times,</li>
  27. <li>then use the browser &larr;/&rarr; buttons button. Yay ! 😊</li>
  28. <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>
  29. </ul>
  30. </div>
  31. </body>
  32. </html>