<newbie> POST to the server

This issue has been tracked since 2022-08-12.

Hi there - I'm using htmx, and having a really good time :-). However, sometimes I just want to POST to the server without returning anything.

For example, after typing a note in a textarea I want to POST the contents to the server, just to keep it safe so when the user clicks OK all the state is serverside. I can't just POST on submit because the structure I'm updating is a graph with the textareas as some of the nodes, and I really don't fancy parsing the names of textareas to determine where in the graph they are ;-).

To be explicit, I have something like this returned from the server:

<div class="new-note">
    <form>
         <input name="action" type="hidden" value='{"action":{"UpdateProposalMessage": "<some serialised path indicating where this node is>"}}' />
        <textarea name="note" hx-post="/note" hx-trigger="mouseout changed"></textarea>
    </form>
</div>

I was hoping I could do something with hyperscript, but it doesn't seem to support a "just POST this and move on with life" ;-). Am I missing something? Don't get me wrong - it all looks fantastic, and I'm really enjoying playing with it - it just seems strange that this isn't supported, so I thought I'd check before writing some javascript.

Thanks!

yatesco wrote this answer on 2022-08-18

Ah, I've just seen I can do this by returning 204: https://htmx.org/docs/#requests

More Details About Repo
Owner Name bigskysoftware
Repo Name _hyperscript
Full Name bigskysoftware/_hyperscript
Language JavaScript
Created Date 2020-05-27
Updated Date 2022-11-25
Star Count 1265
Watcher Count 18
Fork Count 75
Issue Count 86

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date