News for hackers. Stuff that matters.
Re:Htmx by m4lvin on Wednesday December 14, 2022 @03:13PM (#33989679)
How does error handling work? If I try to replace the content of some div with a reply I get using htmx, but the request fails or times out etc., what content is then put into the div? What if the reply is not valid HTML?

Sorry for the newb and lazy questions.

Re:Htmx by recursivedoubts on Wednesday December 14, 2022 @03:22PM (#33989859)
htmx doesn't do anything on an error by default, but you can override this behavior using the extensive event system it has:

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

Re:Htmx by silver-arrow on Wednesday December 14, 2022 @05:36PM (#33991695)
It’s pretty simple to use the htmx events on the Response to handle errors dialogs or other behavior