hx-post

hx-post 属性将导致元素向指定的 URL 发送 POST 请求,并使用交换策略将 HTML 交换到 DOM 中:

<button hx-post="/account/enable" hx-target="body">
  Enable Your Account
</button>

此示例将导致 button/account/enable 发送 POST 请求,并将返回的 HTML 交换到 bodyinnerHTML 中。

注意事项