0

I have written a custom ajax function which uses POST and I need to show the pace progress bar until the ajax stops and returns. It is working fine for GET request because there is no config needed. I need to know how to set a method to show the Pace on ajax calls.

gem 'pace-rails'

Jquery for all ajax requests.

  $(document).on({
    ajaxStart: function() { Pace.start() },
    ajaxStop: function() { Pace.stop() }
  });
Amal
  • 212
  • 2
  • 9

1 Answers1

1

By default track method is set to GET we can add additional methods using these options:

<script>
    window.paceOptions = {
        ajax: {
            trackMethods: ['GET', 'POST', 'PUT', 'DELETE', 'REMOVE']
        },
        restartOnRequestAfter: true
    };
</script>
Amal
  • 212
  • 2
  • 9