Access Query with Ajax

Forums › Forums › Search & Filter Pro › Access Query with Ajax

Tagged: 

Viewing 2 posts – 1 through 2 (of 2 total)
  • Anonymous
    #85908

    https://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/#Access_the_Active_Query_Object

    I’m trying to add a class to different parts of my UI if there are active searches/filters affecting the view. My search form is AJAX enabled, and the above methods of accessing the active search query objects don’t work. If the page refreshes.

    Is there a way to access this data with an AJAX search form?

    Ross Moderator
    #85915

    Hi David

    For now (until next major version which will have JS refresh) the best thing to do is to add the data via PHP, inside your results container.

    So when an ajax request is performed this data is updated.

    I would probably say the best way to do this is create a hidden div, attach data attribute like data-my-sf-data, and in there, json_encode the data / object you want to make available to javascript.

    Then on the sf:ajaxfinish event, read the updated json object back in to your app.

    Hope that makes sense!

Viewing 2 posts – 1 through 2 (of 2 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.