2 ms·
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/
by recursivedoubts 6y ago
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 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.