- This topic has 1 reply, 2 voices, and was last updated 9 years, 2 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Access Query with Ajax
Tagged: ajax
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?
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!