4 ms·
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 rout
by satyrnein 4y ago
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.
- silver-arrow 4y agoYes it can. Right, your server-side routing would have those routes set-up. Naming them can get interesting :)
- codingkoi 4y agoI 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).
- jhot 4y agoMost 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.