I use views_extras module to get default argument froom cookies. It works ok.

But if I set a cookie value using javascript and then refresh a view using ajax the view still shows result for previous value. So the new value affects only if I reload page.

Why and how to make ajax requests use current cookie?

Btw, I wrote my own module to read cookie value and use it as default argument: the result is the same with views_extras module.

  • Are the cookies HttpOnly?
    – Clive
    Apr 5, 2018 at 11:43
  • no, this flag haven't set Apr 6, 2018 at 6:05

1 Answer 1


I figured out that an ajax view already has argument stored in drupalSettings.views.ajaxViews["views_dom_id:..."].view_args

So the view gets this argument and use it instead of default argument from cookie. So we need to change the value of argument as well as cookie.

Your Answer

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

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