Skip to content

Instantly share code, notes, and snippets.

View tclaus's full-sized avatar
🏠
Working from home

Thorsten Claus tclaus

🏠
Working from home
View GitHub Profile
@kohheepeace
kohheepeace / memo.md
Last active October 15, 2024 16:59
Rails ajax comparison (fetch, Rails.ajax, axios, @rails/request.js, Turbo)

Rails ajax comparison (fetch, Rails.ajax, axios, @rails/request.js, Turbo)

I wrote this gist because I felt that the Rails documentation was lacking a description of ajax requests.

📌 Options for ajax request

There are various ways to send ajax requests in Rails.

  1. Browser default Fetch API
  2. Rails.ajax (No Official docs and request for docs)
  3. http client like axios
  4. @rails/request.js 👈 I'm using this one now !