htmx icon indicating copy to clipboard operation
htmx copied to clipboard

[Question] Option to override xhr request with call to my SDK

Open 7flash opened this issue 1 month ago • 7 comments

I understand htmx works best with REST but in my case there is black box SDK in between, therefore I am trying to override beforeRequest to handle form submission with my SDK, wrap it with HTML response and then proceed as normal, can it work?

htmx.on("htmx:beforeRequest", async function(evt){
	const response = await window.my_sdk(evt);
	return `<h1>${response}</h1>`
})

7flash avatar May 09 '24 07:05 7flash