1

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?

  • Are you using D7 or D8? – CodeNext Jul 26 '16 at 15:25
  • @CodeNext I am using D7 – JordanBarber Jul 26 '16 at 15:31
  • And are you using better exposed module also as it is listed in your tags, right? – CodeNext Jul 26 '16 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 – JordanBarber Jul 26 '16 at 15:36
  • @CodeNext Any help? – JordanBarber Jul 26 '16 at 16:37
2

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!

  • 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! – JordanBarber Jul 26 '16 at 18:03
  • This worked great, highly recommend. – JordanBarber Jul 26 '16 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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