Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

htmx triggers a bunch of different events based on various request life cycle events.

For server errors you'd use htmx:responseError:

https://htmx.org/events/#htmx:responseError

You could write some code like so:

   htmx.on("htmx:responseError", function(evt) {
     GrowlNotification.notify({
       title: 'Request Error',
       description: evt.detail.xhr.responseText
     })
   })
And that would show a growl notification in the event of an request error. Or however you wanted to display it.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: