AJAX Requests don't Trigger Pace
I've just 'installed' Pace into my app and it works perfectly on the main page load but on any subsequent AJAX requests that occur after the initial page load the animation doesn't trigger when I believe Pace should handle these automatically?
From reading the docs I think I can manually trigger and stop Pace by doing
Pace.start // Pace.restart ?
$.ajax({
success: function(data) {
Pace.stop
}
});
or even wrap the AJAX requests like so:
Pace.track(function(){
$.ajax(...)
});
but I have a load of requests throughout my app and trying to avoid having to go back and change them all.
I've simply included Pace in my page like so
<!-- pace.js -->
<script type="text/javascript" src="/plugins/pace/pace.js"></script>
<link href="/plugins/pace/pace.css" rel="stylesheet" type="text/css"/>
with no options set etc.
Should've mentioned I'm using jQuery but I've just read through all the previously closed issues and found the answer:
$(document).ajaxStart(function() { Pace.restart(); });
You just saved at least an hour of mine, you're awesome!
glad it helped, the answer was there but just buried away in a closed issue.
Saved me a lot of time! Thank you!
Thank you!
Thank you for this answer! I've been struggleing with this for about an hour already.
Shouldn't this be added to the official docs? Or in a FAQ?
thanks, man. They really should make limit of ajax responce as an option. Now it's 500ms.
Thank you!
Thank you! great job man
Thanks a ton...dude...RESPECT
Tks!!!! Save my day!!!
Thanks.
About an hour looking for an answer that could fix it, and Here is it! Thanks man, more people like you on earth, please lol.
It was a good catch! Thank you! Since pace is loaded at the beginning of the project, much ahead than the jQuery, it was not able to recognize the jquery ajaxStart event. Adding pace to the ajaxStart listener solves the issue.
Thanks.
Thanks martincarlin87... it's worked !!!
Give this man a Cookie! Thanks.
Thank youuuuuuu
感谢老哥
非常感谢
@martincarlin87 this shows the loader when the resquest is called, but doesn't wait the response to hide the loader. Anyone having the same issue?