pace icon indicating copy to clipboard operation
pace copied to clipboard

Disable Pace on all ajax requests

Open REPTILEHAUS opened this issue 8 years ago • 7 comments

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.

REPTILEHAUS avatar Mar 21 '16 14:03 REPTILEHAUS

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?

pafcosta avatar Mar 23 '16 23:03 pafcosta

I am having this same issue for websockets – only the pace bar also stays open/visible persistently.

benhaynes avatar Apr 13 '16 03:04 benhaynes

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.

ntnhieu avatar Apr 28 '16 09:04 ntnhieu

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>

ntnhieu avatar Apr 28 '16 10:04 ntnhieu

This seems to have worked for WebSockets too. Thanks for the update!

benhaynes avatar Apr 29 '16 15:04 benhaynes

this is the only way that works

jjhesk avatar Jan 03 '18 16:01 jjhesk

What am i doing wrong here?

paceOptions = { trackWebSockets: false, ajax: { trackMethods: ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'], } }

interludic avatar Jan 28 '20 05:01 interludic