Support » Plugin: Simple User Listing » User Listing with Ajax, Offset?

  • dyadcom


    I have a custom query working with an Ajax call. There are two search parameters passed through POST that pull in a dynamic list of users based on the two values.

    The initial list returned from the Ajax call works fine. However, using the “Next” button for the next set of 10 users (page 2) directs to “/wp-admin/admin-ajax.php?paged=2”, which is where WordPress’s Ajax call is coming from. Clicking the button directs to a page that says “0” and nothing else (the expected results from the broken Ajax call).

    I’ve been able to configure the Next button to perform another Ajax call instead of doing the default click. However, what I need to happen is offset the list by a number, rather than getting the default first page of users again, in the way the plugin handles the “?paged=2”.

    Is there any way to set a parameter like offset=”10″? Or any other ideas of handling subsequent pages of results with with the Ajax call?

    I can provide my current code, too, if need-be. Thanks for any ideas.

Viewing 1 replies (of 1 total)
  • Plugin Author helgatheviking


    Is there any way to set a parameter like offset=”10″?

    offset is a parameter of WP_User_Query:

    offset (int) – Offset the returned results (needed in pagination).

    see the WP_User_Query codex reference

    I am already calculating the offset to mimic pagination. See the source code.

    It sounds like you need to adjust your ajax call so as not to hit the “/wp-admin/admin-ajax.php?paged=2” url, and send the “paged” info some other way.

    Hope that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘User Listing with Ajax, Offset?’ is closed to new replies.