Remote forms without rails-ujs

How would I do a remote form submit without using rails-ujs? Can’t make it happen, it only makes html/text submits and I cant find any resource about it, only remote forms with ujs.

Please help :smiley:

1 Like

You need to send an Ajax request. Just look at the code of rails-ujs. They are doing it and it is written there. iThe whole library is like a few hundred lines.

You attach a listener to the button, and when the client hits send you send request with application/json or javascript type.

I have a small tutorial that might help. It uses the fetch api to post to an API.

3 Likes

Whats the downside vs upside of using ujs? I would happily do without jQuery?

Modern Rails UJS doesn’t require jQuery.

Walter