2

I am using the Views module and have created a view for a content type. I have added an exposed filter so that the user can filter the list of content based on a custom taxonomy.

I want to use AJAX for filtering the content. Before I select 'yes' under 'use AJAX' in the 'advanced' tab, the filter appends the filter selection to the URL such as /content-type-view?category='selected-category'. But once I select AJAX, I lose the update to the URL.

I want to combine the two, use AJAX but also have unique URL's so that I can direct users to pre-filtered instances of the view.

What am I doing wrong?

9
  • Are you using D7 or D8?
    – CodeNext
    Jul 26, 2016 at 15:25
  • @CodeNext I am using D7 Jul 26, 2016 at 15:31
  • And are you using better exposed module also as it is listed in your tags, right?
    – CodeNext
    Jul 26, 2016 at 15:31
  • Yes, I am using 'better exposed'. Although the above question is not specific to the 'better exposed' module, I will eventually be using that to 'auto-submit' the filter selected in conjunction with the 'advanced' tab AJAX Jul 26, 2016 at 15:36
  • @CodeNext Any help? Jul 26, 2016 at 16:37

1 Answer 1

3

What you want to do is manipulate the browser's URL even though there are no page reloads, only AJAX requests taking place.

You are actually in need of the HTML5 History API.

And luckily there seems to be a module available, specific to your case:

https://www.drupal.org/project/views_ajax_history

Give this a try and good luck!

3
  • Thanks for this, I have definitely used the HTML5 History API before, but thought that there was a way to make this happen within the Views module. I'll give the above module a shot and see how it works. Thanks! Jul 26, 2016 at 18:03
  • This worked great, highly recommend. Jul 26, 2016 at 19:58
  • Worked for me like a charm, thx!!
    – DarkteK
    Oct 24, 2022 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.