DEV Community

Benji 🍙
Benji 🍙

Posted on

TIL HTMX is way faster than writing AJAX logic directly inside a Django template

e.g. In my Django template I might have:

{% load ajax %}

<button id="my-button">Click me</button>

<script>
$(document).on("click", "#my-button", function() {
  $.ajax({
    url: "/my-view",
    type: "GET",
    success: function(data) {
      // Do stuff
    }
  });
});
</script>
Enter fullscreen mode Exit fullscreen mode

but with HTMX you can just do this:

<button id="my-button" hx-post="/my-view"></button>

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more