I tried to execute a DELETE request inside htmx, but i can’t execute that. I don’t know what is the reason.
The code of htmx delete button:
<button
class="icon-button"
hx-delete="/api/method/Book/delete_book?name={{ book.name }}"
hx-target="#book-list"
hx-swap="outerHTML remove"
>
The book.py code:
@frappe.whitelist(allow_guest=True)
def delete_book(name):
if frappe.db.exists("Book", name):
frappe.delete_doc("Book", name)
frappe.db.commit()
return {"message": "Book deleted successfully"}
else:
frappe.throw("Book not found")
The output img: