DELETE Request failed in HTMX

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:

      hx-delete="/api/method/Book/delete_book?name={{ }}"
      hx-swap="outerHTML remove"

The code:

def delete_book(name):
    if frappe.db.exists("Book", name):
        frappe.delete_doc("Book", name)
        return {"message": "Book deleted successfully"}
        frappe.throw("Book not found")

The output img:

1 Like

Use error handling to get exact error. Sometimes we can’t delete, if the document have connections.

1 Like

Tell me if you got any error now??

hey @MachoMaheen, can you please share a link to your project and/or github repo, whichever you’re comfortable with.

I’ve been wondering what ERPNext and HTMX would look like

1 Like