pace
pace copied to clipboard
Disable Pace on all ajax requests
I am working on a site and one of the pages has ajax calls I have tried to disable the ajax loader using every method you have in your docs but it still displays on the site
<script type="text/javascript" data-pace-options='{ "ajax": false }' src="./assets/js/pace.js"></script>
<script>
Pace.options = {
ajax: false
}
Pace.options = {
ajax: {ignoreURLs: ['services']}
}
</script>
And I have tried wrapping this on the ajax calls themselves
Pace.ignore(function(){
$.ajax({
url: appajax.ajaxurl,
type: "POST",
cache: false,
//type: 'post',
data: { action: 'ajax_posts', page: loadPage },
success: function( html ) {
$('.ajax-display').hide().append( html ).fadeIn(400);
}
})
});
What am I doing wrong.. Basically i just want pace for actual page loads and not for ajax requests at all on the site.
Hi, I'm experience the same issue. In other project this working exactly as you have, but this new one, the same code doesn't work. Can someone can some tip?
I am having this same issue for websockets – only the pace bar also stays open/visible persistently.
You can ignore ajax with this way
Pace.ignore(function(){ $.ajax({...}); }
These ways "Pace.options" or "paceoptions" do not run, I think them are errors on Pace.js.
I resolved for ajax: You need to configure options before load pace.js.
<script>
window.paceOptions = {
ajax: false,
restartOnRequestAfter: false,
};
</script>
<script src="../pace.js"></script>
This seems to have worked for WebSockets too. Thanks for the update!
this is the only way that works
What am i doing wrong here?
paceOptions = { trackWebSockets: false, ajax: { trackMethods: ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'], } }