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)