Replies: 2 comments 1 reply
-
|
hx-post parameter should be an url not a path: "/update.php" without the dot |
Beta Was this translation helpful? Give feedback.
-
To fix your problem, you'll want to write <div id="timeCont" hx-post="./update.php" hx-target="this" hx-swap="afterend">
<button type="button">Update time</button>
</div>Or, if you want to keep the attributes on the button: <div id="timeCont" >
<button type="button" hx-post="./update.php" hx-target="#timeCont" hx-swap="afterend">Update time</button>
</div> |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
this is taken from examples and modified for testing purposes,
update.phpreturns the date time stringthe behavior is that the button is substituted by the date time string while , targeting the #timeCont DIV and using hx-swap 'afterend' I have understood that the date time string should be appended after the DIV
Am I wrong? I have tried both 'afterend' and 'beforeend', but for either the two , the button disappears. In other words inside the DIV it remains only the date time string.
Please also note , for either the two, the date time string is INSIDE the DIV
Interesting behavior, clicking the date time string, so the innerHTML , the date time updates :-)
Thank you for hinting
Beta Was this translation helpful? Give feedback.
All reactions