Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 465
Cyril Duchon-Doris Avatar asked Nov 08 '22 14:11

Cyril Duchon-Doris


1 Answers

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

like image 135
ekampp Avatar answered Nov 14 '22 23:11

ekampp