careful-room-54859
01/30/2022, 2:20 AMmysterious-toddler-20573
01/30/2022, 2:21 AMcareful-room-54859
01/30/2022, 2:22 AMcareful-room-54859
01/30/2022, 2:22 AMcareful-room-54859
01/30/2022, 2:23 AMcareful-room-54859
01/30/2022, 2:24 AMbrainy-ice-92385
01/30/2022, 3:29 AMhx-swap with HX-Trigger response header. What else can I do to debug this?
hx-trigger: { "test" : "test" } shows up in the resposne headers in dev tools
I have this at the end of body
<script type="text/javascript">
document.body.addEventListener("test", function(evt){
alert("myEvent was triggered!");
})
</script>
And I tested the above with document.body.dispatchEvent(new Event("test")) and the alert does trigger from that test, but not on my trigger codemysterious-toddler-20573
01/30/2022, 3:35 AMmysterious-toddler-20573
01/30/2022, 3:35 AMbrainy-ice-92385
01/30/2022, 3:37 AMbrainy-ice-92385
01/30/2022, 3:38 AMbrainy-ice-92385
01/30/2022, 3:51 AMi flag, so I don't suppose it's that.brainy-ice-92385
01/30/2022, 4:01 AMAccess-Control-Allow/Expose-Headers Edit: YES! Wahoo! RTFM FTW 🙂powerful-evening-99811
01/30/2022, 10:15 PMsteep-france-23568
01/30/2022, 11:11 PMhx-post ) timed out and ask them to click the button again. How would I implement this with HTMX and/or Hyperscript and/or AlpineJS though?
I figured the simplest way would be to change the button's colour if the request times out. Or I could show a notification overlay. But I'm not sure how to get notified of the hx-post success or failure. Any pointers would be great.
Thanks all.mysterious-toddler-20573
01/30/2022, 11:27 PMmysterious-toddler-20573
01/30/2022, 11:28 PMsteep-france-23568
01/30/2022, 11:31 PMhtmx:beforeRequest to change the button to a waiting indicator, then listen for htmx:sendError and/or htmx:timeout to change it to a "please retry me" state and finally listen for htmx:afterRequest and change it to a success state.mysterious-toddler-20573
01/30/2022, 11:31 PMmysterious-toddler-20573
01/30/2022, 11:32 PMsteep-france-23568
01/30/2022, 11:32 PMsteep-france-23568
01/30/2022, 11:32 PMlate-king-98305
01/31/2022, 12:28 AMmysterious-toddler-20573
01/31/2022, 12:29 AMlate-king-98305
01/31/2022, 12:30 AMmysterious-toddler-20573
01/31/2022, 12:30 AMmysterious-toddler-20573
01/31/2022, 12:30 AMmysterious-toddler-20573
01/31/2022, 2:23 AMmysterious-toddler-20573
01/31/2022, 2:56 AM