I use Stimulus with Rails.
The process is as follows:
- click on a button that points to an action in controller
- action sends AJAX request to API (Rails based)
- API returns JSON which I want to assign to variable and work on it later (add nodes to a DOM)
I’m struggling to do that because AJAX is asynchronous. Is there any workaround for this?