O
O
Orange Banana2017-01-22 19:49:33
Django
Orange Banana, 2017-01-22 19:49:33

Cookies. How to remember the performed action?

Hello. There is a voting form

<form action="{% url 'posts:votes'  post.chpu  %}" method="post">
          {% csrf_token %}
            <button name="butt" id="plus-rat type="submit">Да</button>
            <button>Нет</button>

          </form>

After clicking on any button, you need the form to disappear, how to implement this using cookies? So that after refreshing the page and after the next visit to the page, it would also be hidden. (I think this is the point of cookies - to remember)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Khmyrov, 2017-01-22
@vivcogit

It is worth writing in cookies only those values ​​that are needed for data exchange with the server, because cookie is sent with each request (unless specifically disabled), it's better to use localStorage.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question