You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I help our team to implement a simple GUI based on the restapi. I use htmx + client template (nunjucks) + bootstrap to render the page which look pretty good to me. Due to our business logic, i can not change parameter and payload of restapi. But nunjucks template works pretty good to transform json into html dynamically.
But i meet one issue recently. Once a hx-get is triggerd, I need to render dynamic html with mixture of response json payload and parameter in URL of hx-get. For sure i can not change restapi to add parameter in the return json payload. Is there any extension or event that i can use in conjunction with client template to realize this? I do not mind to write some simple javascript code but i really want to know what is the cleanest way to implement this.
e,g. <div hx-get="/api/object?value=foobar">
How could i render client template with title <div>foobar</div>?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I help our team to implement a simple GUI based on the restapi. I use htmx + client template (nunjucks) + bootstrap to render the page which look pretty good to me. Due to our business logic, i can not change parameter and payload of restapi. But nunjucks template works pretty good to transform json into html dynamically.
But i meet one issue recently. Once a hx-get is triggerd, I need to render dynamic html with mixture of response json payload and parameter in URL of hx-get. For sure i can not change restapi to add parameter in the return json payload. Is there any extension or event that i can use in conjunction with client template to realize this? I do not mind to write some simple javascript code but i really want to know what is the cleanest way to implement this.
e,g.
<div hx-get="/api/object?value=foobar">
How could i render client template with title
<div>foobar</div>
?Thank you.
Beta Was this translation helpful? Give feedback.
All reactions