0

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.

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

1 Answer 1

0

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 you have read our privacy policy.

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