https://htmx.org logo
I have a very basic question, just trying out htmx...
# 🔥-django-htmx
c
I have a very basic question, just trying out htmx. I have a button:
Copy code
<button 
  hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
  hx-post="{% url "listings:listing-favorite" listing.slug %}"
>
  Some text
</button>
the post view returns some json like
{"added": id}
or
{"removed": id}
I would like to toggle a class on the button if the response is
{"added": id}
. Is it possible to do?