We're sunsetting PodQuest on 2025-07-28. Thank you for your support!
Export Podcast Subscriptions
cover of episode The basics: hx-vals

The basics: hx-vals

2024/2/1
logo of podcast hx-pod

hx-pod

Shownotes Transcript

How do you feel about setting your request values right there inline?

STATIC<button hx-get="/my/weather/data"              hx-trigger="click"              hx-vals='{"location": "01245"}'>   Click for weather in one static location</button>

DYNAMIC<button hx-get="/my/weather/data"              hx-trigger="click"              hx-vals='js:{location: document.getElementById("zipcode").value}'>   Click for weather in one static location</button>

OR<button hx-get="/my/weather/data"              hx-trigger="click"              hx-vals='js:{location: someJavascriptCalculationFunction()}'>   Click for weather in one static location</button>