uajax - Universal Ajax Forms or how I created htmx killer

Updated: 10th May 2023
Tags: javascript html forms ajax

Backstory

Nearly two years (actually almost three) ago, I was migrating admin panel from bootsrap 4 to bootstrap 5 alpha. I was using a lot of jquery and a lot of jquery ajax functions that were written like 10 years ago. So to clean this mess I wanted to make single func to rule them all.

With new bootstrap 5 without jquery I searched for something. I even tried htmx. But I didn’t like it (it has some weird syntax that is not valid html and most editors don’t like it too). I also don’t like js (at that time).

So what to do if you want to remove jquery dependency, don’t like js, and don’t like htmx because its syntax is meh? Right - you write your own library 😍

uajax - universal ajax forms

Demo Requests
Demo Todo App

I’ve made uajax, and it was like add class js-uajax-form to any form, and you’re done. There are a lot of features you can enable with data attributes (like hide target, insert into target, remove target, reload, redirect and so on).

I know I’m biased but still this shi* is awesome.

ajax-button - make any button ajaxed

Demo

There were some moments when adding form is too much, I needed to make uajax for single button. So I made function ajax-button to make button ajaxed. Today I published it. Adding settings made it 2x size, in original it was a bit simpler :(. Feel free to modify it.

Conclusion

Sometimes, when you need something and can’t find, you can make it.