hx-deletehx-delete 属性将导致元素向指定的 URL 发送 DELETE 请求,并使用交换策略将 HTML 交换到 DOM 中:
<button hx-delete="/account" hx-target="body">
Delete Your Account
</button>
此示例将导致 button 向 /account 发送 DELETE 请求,并将返回的 HTML 交换到 body 的 innerHTML 中。
hx-delete 不可继承DELETE 后的元素,请返回带有空正文的 200 状态码;如果服务器响应 204,则不进行交换,此处记录: 请求与响应