Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can the same server side code render that fragment, regardless of whether it's part of the initial page load or a subsequent update? You need an additional route for the Ajax call, right? Just curious how this gets structured.


I haven’t used it recently but I believe it sets a header on the request when it comes from HTMX so you can change whether you send the whole page or just the fragment back.

You can also just send the whole page and use other features to select just the part that you want to update (obviously that has a cost of sending the whole page though).


Most template engines have some form of inheritance making it easy to render just the fragment or include it in a full page based on route.


Yes it can. Right, your server-side routing would have those routes set-up. Naming them can get interesting :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: