Jump to content

[solved] Immediate ajax request not detected.


bernhard
 Share

Recommended Posts

Hey @adrian I'm using ProcessPageList() to render a pagelist in my custom process module. I wondered why I only get bd() calls in the debug bar for ajax requests when collapsing a tree item, but not for the very first one. This is my code:

        <div id='pageviews'></div>
        <script>
          $('#pageviews').ProcessPageList({
            rootPageID: 1,
            showRootPage: true,
            ajaxParams: {'rockcounter': true},
          });
        </script>

I then tried wrapping that code in setTimeout() with a delay of 1000ms and then I got the bd() calls also for the very first request.

Is there any recommended way of dealing with this? I tried to wait for dom ready, but that seems to be too early and tracy didn't catch the first request. On my laptop it works with a delay of 100ms, but in other setups it might be different, so I'm wondering if there is a solid way of waiting for tracy to capture the ajax call?

Link to comment
Share on other sites

Works for me if it's inside a:

$(document).ready(function() {

On a somewhat related note, are you making sure to manually call:

$this->wire('modules')->get('ProcessPageList');

I wasn't getting the page list to load without that. I assume you are because you're in a process module, but I wasn't getting it to work and came across this old thread: https://processwire.com/talk/topic/15938-typeerror-aprocesspagelist-is-not-a-function-in-admin/

  • Like 1
Link to comment
Share on other sites

  • bernhard changed the title to [solved] Immediate ajax request not detected.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...