Javascript variable for results count

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)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.