Cyril Duchon-Doris
Cyril Duchon-Doris

Reputation: 13999

Show Turbolinks loading bar on custom AJAX request

I am using Turbolinks 5 and there is this nice loading bar at the top that shows up for turbolinks-activated links.

It it possible to trigger manually/programmatically the display/progress of this bar for custom AJAX calls (maybe even any AJAX call ?)

I am targeting specifically the submit of remote forms (AJAX) for POST/GET requests. I know about turboforms, which I also sometimes use, but in some cases I expect a more clever JS response from the server, that only generates/reloads part of the page, and I would still like to use Turbolinks' AJAX feedback.

Upvotes: 5

Views: 799

Answers (1)

ekampp
ekampp

Reputation: 1959

Based on the list of turbolink events, it seems possible to display the bar by emitting a turbolinks:click event.

It also seems possible to call the progressbar class it self.

I hope this at least helps you get on the right path.

Happy coding

Upvotes: 1

Related Questions