N
N
Nohaga2019-10-01 11:44:38
JavaScript
Nohaga, 2019-10-01 11:44:38

Why is the jquery cookie not being saved?

$(document).ready(function(){
  $.cookie('do_order', 'yes', { expires: 7}); console.log($.cookie('do_order'));
  window.location.href = "/";
});

Cookies are assigned to the console output, after reloading the page undefined

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Neverov, 2019-10-01
@TTATPuOT

Most likely, you are using the library incorrectly.
Use mine: https://github.com/TTATPuOT/vanilla-js-cookies - it's pure JS and doesn't require jQuery.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question