点击加载

此示例展示了如何在数据表格中实现点击加载下一页。演示的核心是最后一行

<tr id="replaceMe">
  <td colspan="3">
    <button class='btn primary' 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>

这一行包含一个按钮,它将用下一页结果替换整行(其中将包含一个按钮来加载下一页结果)。以此类推。

服务器请求 ↑ 显示

🔗演示