Set cookie for a few minutes on javascript.



  • Setting cookie like:

    $.cookie("name-cookie", "no", { expires: 30, path: '/'});
    

    But the corns are set for 30 days and 30 minutes.

    I understand that expires: meaning in the days.

    Can you tell me how to set up a few minutes in the php I know how to set it up and how to jquery or clean javascript?



  • It's all sorted out.

    var new_minut = new Date();
    new_minut.setMinutes( 30 + new_minut.getMinutes());
    $.cookie("name-cookie", "no", { expires: new_minut, path: '/' });
    

    The matter is closed.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2