Click To Load

This example shows how to implement click-to-load the next page in a table of data. The crux of the demo is the final row:

<tr id="replaceMe">
  <td colspan="3">
    <button class='btn' hx-get="/contacts/?page=2" 
                        hx-target="#replaceMe" 
                        hx-swap="outerHTML">
         Load More Agents... <img class="htmx-indicator" src="/img/bars.svg">
    </button>
  </td>
</tr> 

This row contains a button that will replace the entire row with the next page of results (which will contain a button to load the next page of results). And so on.

Server Requests : 1 ↑ Show
GET /contacts/?page=2
parameters: {"page":"2"}
Response
<tr><td>Agent Smith</td><td>void20@null.org</td><td>5F2130E800CE9D7</td></tr>
<tr><td>Agent Smith</td><td>void21@null.org</td><td>51G773A3825FE3G</td></tr>
<tr><td>Agent Smith</td><td>void22@null.org</td><td>0G6FAGF2E9F0069</td></tr>
<tr><td>Agent Smith</td><td>void23@null.org</td><td>76958868GAE90CB</td></tr>
<tr><td>Agent Smith</...

Demo

Name Email ID
Agent Smith void10@null.org FDF8614510EE9D5
Agent Smith void11@null.org CDB00GAE30E8E7C
Agent Smith void12@null.org 789C9G3C735733E
Agent Smith void13@null.org 7A0B875A9AAG775
Agent Smith void14@null.org GF87G0C3E3FFF2B
Agent Smith void15@null.org 166A5C360950A4D
Agent Smith void16@null.org 0A30EC04G873B33
Agent Smith void17@null.org F4B81F778D984C8
Agent Smith void18@null.org 80B6A32B9592816
Agent Smith void19@null.org B02BE5C2B4CGC26
Agent Smith void20@null.org 5F2130E800CE9D7
Agent Smith void21@null.org 51G773A3825FE3G
Agent Smith void22@null.org 0G6FAGF2E9F0069
Agent Smith void23@null.org 76958868GAE90CB
Agent Smith void24@null.org DA5B31FDACDB98B
Agent Smith void25@null.org CC226DF2EB3734G
Agent Smith void26@null.org 227A074E15D42DE
Agent Smith void27@null.org AA85F6F6BED2GFF
Agent Smith void28@null.org BFD09B24CB5B753
Agent Smith void29@null.org AC65B38404GDGE1