Forums Forums Search & Filter Pro Javascript variable for results count

Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #219092

    I need to give the masonry plugin I use a total amount of results. Is there a way your plugin gives me a js variable that has that amount. Is there another way to do it?

    Trevor
    #219105

    Before I ask our developer, Ross, whether that can be done from our end, how would you pass it to your plugin? Are you using our ajaxfinish event?

    Anonymous
    #219148

    Yes, I’m using the ajaxfinish event.

    Trevor
    #219167

    I will ask Ross if this exists.

    Ross Moderator
    #219218

    Hi Brian

    Its not possible yet.

    There is a workaround you can do though.

    Inside your results area (the area you defined as your Ajax Container), you can add a hidden input:

    <input type="hidden" name="number-of-posts" value="<?php echo $query->found_posts; ?>" id="number-of-posts" />

    (Depending on your display method, $query might have a different variable name such as $wp_query)

    Then, in your JS sf:ajaxfinish event, you can grab the value like:

    var noPosts = $('#number-of-posts').val();

    Let me know how you get on.

    Thanks

Viewing 5 posts - 1 through 5 (of 5 total)