A
A
Anton2020-04-21 14:00:23
JavaScript
Anton, 2020-04-21 14:00:23

How to read cookies with brackets?

I set cookies like this:

document.cookie = "DELIVERY[CITY]=Москва";
или
document.cookie = "DELIVERY[REGION]=" + suggestion.data.region;

And how then to read them and check that it is not empty to fulfill the condition?
In Google, I did not find options in square brackets.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kn1ght_t, 2020-04-21
@kn1ght_t

what's with the square brackets? square brackets - this is part of the key
you have keys:
DELIVERY[CITY]
DELIVERY[REGION]
respectively, for these keys and you need to get the values

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question