mysterious-toddler-20573
12/19/2022, 9:33 PMancient-shoe-86801
12/19/2022, 9:43 PMvictorious-thailand-80225
12/20/2022, 2:53 AM<script ... htmx />
. On the click of a button, I call a GET endpoint (say GET /something?param=gg
and I replace a div in the page with the returned div <div id="imreturned">
. Later I realized that the <div id="imreturned">
is useful apart from the main page, so I want to be able to display something meaningful on http://www.mypage/something?param=gg
without going into main page. But the issue is then I have to return the header section also on /something
endpoint. But this would cause issues with embedding this in main page right? And it feels yucky. What can I do here?
Sorry if that's too long winded.mammoth-family-48524
12/20/2022, 3:19 AMvictorious-thailand-80225
12/20/2022, 4:00 AMfreezing-controller-74032
12/20/2022, 12:05 PMjavascript
<script>
function monitorVideo() {
if ((videojs('my_video').duration() - videojs('my_video').currentTime()) < 10)
myFunction();
}
function myFunction() {
activation htmx post request
setInterval(monitorVideo, 100);
}
</script>
This script check if less than 10 seconds are left before the end of the video, it starts the myFunction()
how can i integrate activation htmx post request there to run it ?mammoth-family-48524
12/20/2022, 12:21 PMfreezing-controller-74032
12/20/2022, 12:32 PMproud-librarian-99598
12/21/2022, 7:07 AMhx-swap
attributes? At the start of the documentation page https://htmx.org/attributes/hx-swap/, beforeend
is used, but then in examples further down beforeEnd
is used. The reason for asking is that I have always used beforeend
, but the IntelliJ plugin (https://github.com/hugohomesquita/htmx-jetbrains) now has code completion that suggests beforeEnd
.bulky-kilobyte-96254
12/21/2022, 1:57 PMsparse-musician-64201
12/21/2022, 1:58 PMsparse-musician-64201
12/21/2022, 1:58 PMbulky-kilobyte-96254
12/21/2022, 1:59 PMbulky-kilobyte-96254
12/21/2022, 1:59 PMbulky-kilobyte-96254
12/21/2022, 2:00 PMbulky-kilobyte-96254
12/21/2022, 2:02 PMbulky-kilobyte-96254
12/21/2022, 2:02 PMbulky-kilobyte-96254
12/21/2022, 2:06 PMancient-shoe-86801
12/21/2022, 5:15 PMancient-shoe-86801
12/21/2022, 5:19 PMancient-shoe-86801
12/21/2022, 5:19 PMbulky-kilobyte-96254
12/21/2022, 8:15 PMadd-to-cart
blade component which makes a hx-post
call to add a product to the cart. This button exists in the overview page (in a loop, button in every product card) and also on the detail page of this product. I'd want to swap this button to a 'delete' button instead. For the product page I could easily just return that fragment, but not sure how to go about this for the overview page in that loop. Any ideas?bulky-kilobyte-96254
12/21/2022, 8:18 PMredirect()->back()
in this API call, and hx-swap="body"
, but that feels pretty gross.proud-librarian-99598
12/21/2022, 8:19 PMbulky-kilobyte-96254
12/21/2022, 8:26 PMhx-swap-oob
attribute on it disappears as wellbulky-kilobyte-96254
12/21/2022, 9:18 PMhx-swap-oob
attribute would be removed. It is returned in the HTML response of the request.witty-doctor-93385
12/21/2022, 9:29 PMwitty-doctor-93385
12/21/2022, 9:29 PM