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() }
});
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.