Live data from Hacker News

Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby

alpine-ajax.js.org

21–26 of 26 posts

Re: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby

#21
post #19

Can it do something similar to hx-trigger="load"?

Yeah, Alpine components have `x-init` that works just like the load trigger. You can fire off an AJAX request inside that directive, there's an example here: https://alpine-ajax.js.org/examples/lazy-load/

Interesting. Some of the concepts work quite beautifully. For the advanced feature, I often prefer HTMX. In any case, a really cool project! Congrats.

Re: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby

#22

All of these related projects remind of Dojo Didgets from the mid 2000s. Not that that's a bad thing, I found that tool kit very productive! Anyone else remember Dojo fondly? Am I way off base here?

I also remember Dojo, Dijit and DojoX. It was a powerful web framework. https://dojotoolkit.org

Re: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby

#25

A few features which look minor but the author got totally right, which IMHO would allow this solution to scale very well with more complex applications. 1) X-Alpine-Target ``` generates an ajax request with this header by default: ``` X-Alpine-Target: comments comments_count ``` This is very very cool! In most usecases, one the serverside I can return a full html document and alpine-ajax will only look for #comments…

Thank you! I really have tried to sweat those details, it's reassuring to hear that's coming through.

random idea: an event for "x-sync:missing". the server responds with ``, but the page doesn't have a matching id (and the notifications aren't inside a different target....). if the last part is slow to figure out, people could opt into it with "x-sync x-sync-required".
Post reply on HN