4 ms·
By wiring up hooks I just mean binding a callback to a button that calls fetch() and processing the response (usually replacing HTML, but may modify content and
by cpburns2009 3mo ago
By wiring up hooks I just mean binding a callback to a button that calls fetch() and processing the response (usually replacing HTML, but may modify content and classes on other elements). Basically what I'm looking for is being able to specify a callback (ideally just a global name set from HTML) that will be called with a response object when JSON is returned. I prefer most coding to happen server side, but sometimes client side JS is needed.
- masfoobar 2mo agoBut you can do this with htmx by using the respected hx-* attributes. For example, on button click to GET html. Again, you can specify what you want to do with the returned html with attributes such as hx-swap Unless I am misunderstanding, of course. I do remember triggers/hooks with things like Angular and Knockout. I don't miss this method of web development. I recommend starting small and working up with htmx. Their examples section on the official website is pretty good.