bumpy-pilot-80789
09/04/2022, 7:55 PMwindow
, which is the html
-tag, I thinkbumpy-pilot-80789
09/04/2022, 7:56 PMlate-king-98305
09/04/2022, 7:57 PMXMLHTTPRequest
under the hood, which means that a) it's going to follow redirects before you ever get it back (not an issue here); and b) 4xx and 5xx responses are going to be interpreted as errors, which means they're going to follow a different code path.
I would almost either return a body with a simple "yes" or "no"; return a separate (maybe custom) header that indicated success or failure; or use an HX-Trigger
header in the response to show either your "yay!" or "boo..." modal. https://htmx.org/headers/hx-trigger/
(404 indicates that there is a problem with the request itself. In this case, I think the request (i.e., transport) works, so returning some sort of 2xx response is going to be appropriate in either case.)late-king-98305
09/04/2022, 7:57 PMbumpy-pilot-80789
09/04/2022, 7:58 PMbumpy-pilot-80789
09/04/2022, 7:58 PMlate-king-98305
09/04/2022, 8:00 PMlate-king-98305
09/04/2022, 8:00 PMbumpy-pilot-80789
09/04/2022, 8:00 PMlate-king-98305
09/04/2022, 8:05 PMbumpy-pilot-80789
09/04/2022, 8:10 PMbumpy-pilot-80789
09/04/2022, 8:10 PMgorgeous-ghost-95789
09/04/2022, 8:12 PMbitter-manchester-50350
09/05/2022, 12:41 AMdry-pharmacist-51808
09/05/2022, 1:10 AMtall-river-23601
09/05/2022, 4:59 AMstocky-dentist-80693
09/05/2022, 8:45 AM#results
tag. Then I have the search field wired up with hx-select="#results" hx-target="#results" hx-get="{$current_url}"
so the table + pager get updated. All from one route & template partial.fancy-elephant-10660
09/05/2022, 8:57 AMblue-ghost-19146
09/05/2022, 11:07 AMlate-king-98305
09/05/2022, 2:21 PMcold-actor-53931
09/05/2022, 2:22 PMbland-coat-6833
09/05/2022, 2:27 PMcold-actor-53931
09/05/2022, 2:37 PMbland-coat-6833
09/05/2022, 3:02 PMcold-actor-53931
09/05/2022, 3:17 PMgorgeous-ghost-95789
09/05/2022, 3:41 PMblue-ghost-19146
09/05/2022, 4:01 PMlittle-state-82457
09/05/2022, 7:42 PMhref
and hx-get
because I've got a couple of htmx-controlled items and pagination on the page and I'm trying to keep track of their state via querystrings. For example: ?tab=whatever&page=2
.
I've been trying something like this, which seems like it should work, but it's only ever paying attention to what's set on the hx-get
when it first loads. The `href`s and the `hx-get`s update in the DOM and I get no errors. Help? ๐ฅบ
_="on updateRequest(string)
set my @href to `?something&$string`
then set my @hx-get to my @href
then call htmx.process(me)"