pace-rails 未显示 post 个请求

pace-rails not showing for post requests

我编写了一个使用 POST 的自定义 ajax 函数,我需要显示速度进度条,直到 ajax 停止和 returns。它适用于 GET 请求,因为不需要配置。我需要知道如何设置一种方法来显示 ajax 调用的速度。

gem 'pace-rails'

Jquery 所有 ajax 个请求。

  $(document).on({
    ajaxStart: function() { Pace.start() },
    ajaxStop: function() { Pace.stop() }
  });

默认跟踪方法设置为 GET 我们可以使用这些选项添加其他方法:

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