Jump to content

Change filter selector without page refresh respectively get values through JS/jQuery to PHP to change Selectors?


Orkun
 Share

Recommended Posts

I know that the Topic title is probably confusing(sry for that :)). Let me explain my Question:

I have two Filters(Main Filter & Detail Filter) like you can see below. When I click on a main filter it gets bold and will be added to the "Meine Auswahl(my selection)" container below the Filters. When I click on the "X" span inside the "My Selection" Container, the selected Filter gets resetted. Now, what I want to achieve is a ajax Filter which changes the php Selector for the for the $pages->find().

For Example:

When I come to that page, the selector for the main and detailfilter should look like this:

$branches = $pages->find("template=branch"); // Main Filters
<?php $genres = $pages->find("template=genre, select_sparte=''"); ?> //Detailfilters (Returns a NullPage so dont show the Detailfilters when none main filter is selected)

When I select for e.g Example Filter 1 it should change to this without a page refresh:

<?php $genres = $pages->find("template=genre, select_sparte.title='Example Filter 1'"); ?>

So that I get the Detail Filters of Example Filter 1 without a page refresh. Is this even possible? When yes how, can you guys show me a direction?

post-3125-0-83193300-1455626571_thumb.pn

post-3125-0-47611200-1455625934_thumb.pn

Link to comment
Share on other sites

You could write a PW page/template that handles nothing but the selectors and returns results as JSON. (written in PHP, with header("Content-type: application/json"); at the top)

On the page where this filter is used, you would include some JS that handles the user-selection and talks to the above-mentioned script via AJAX. json_encode + json_decode are your friend :)

  • Like 1
Link to comment
Share on other sites

You could write a PW page/template that handles nothing but the selectors and returns results as JSON. (written in PHP, with header("Content-type: application/json"); at the top)

On the page where this filter is used, you would include some JS that handles the user-selection and talks to the above-mentioned script via AJAX. json_encode + json_decode are your friend :)

Could you possibly make an example, or show one? That would be very helpful since I am not so advanced in AJAX/JSON.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...