adamant-exabyte-92636
12/27/2021, 2:48 PMhx-swap
should rather be hx-trigger
adamant-exabyte-92636
12/27/2021, 2:50 PMclick
in this case), it should return a boolean. So perhaps add a return true
at the end of your testing functionblue-gold-89534
12/27/2021, 2:57 PMhtml
<button hx-get="{% url 'detail' product.pk %}"
hx-trigger="click[testing]"
hx-swap="outerHTML">
test
</button>
JS
var testing = function () {console.log("test");return true}
I tried it like this (there was a mistake in the hx events in the first post) and with the hx-trigger in it, the hx-get stops workingblue-gold-89534
12/27/2021, 3:03 PMblue-gold-89534
12/27/2021, 3:05 PMadamant-exabyte-92636
12/27/2021, 3:10 PM[testing]
and confirm that it works without the filter?blue-gold-89534
12/27/2021, 3:12 PMhtml
<button hx-get="{% url 'detail' product.pk %}"
hx-trigger="click"
hx-swap="outerHTML">
test
</button>
adamant-exabyte-92636
12/27/2021, 3:13 PMtesting
function variable available in the global scope?adamant-exabyte-92636
12/27/2021, 3:14 PMadamant-exabyte-92636
12/27/2021, 3:20 PMadamant-exabyte-92636
12/27/2021, 3:21 PMadamant-exabyte-92636
12/27/2021, 3:21 PMadamant-exabyte-92636
12/27/2021, 3:21 PM[testing()]
adamant-exabyte-92636
12/27/2021, 3:22 PMadamant-exabyte-92636
12/27/2021, 3:23 PMhtml
<button hx-get="{% url 'detail' product.pk %}"
hx-trigger="click[testing()]"
hx-swap="outerHTML">
test
</button>
adamant-exabyte-92636
12/27/2021, 3:30 PMadamant-exabyte-92636
12/27/2021, 3:31 PMblue-gold-89534
12/27/2021, 3:58 PMblue-gold-89534
12/27/2021, 3:59 PMadamant-exabyte-92636
12/27/2021, 4:00 PMwhite-motorcycle-95262
12/27/2021, 4:36 PMmysterious-toddler-20573
12/27/2021, 4:38 PMHX-Redirect
to the file URL, it should download properlywhite-motorcycle-95262
12/27/2021, 4:43 PMwhite-motorcycle-95262
12/27/2021, 4:44 PMwhite-motorcycle-95262
12/27/2021, 4:53 PMself.filepath
in the image above is the actual location of the file on my server: there's no view or URLConf entry that serves up this file, so I'm not sure HX-Redirect will work, since I think it expects a URLmysterious-toddler-20573
12/27/2021, 5:23 PMwhite-motorcycle-95262
12/27/2021, 5:30 PMmysterious-toddler-20573
12/27/2021, 5:55 PMwhite-motorcycle-95262
12/27/2021, 6:06 PMprehistoric-cat-63987
12/27/2021, 9:58 PM