jquery Action Cookie

Source: Internet
Author: User
Tags set cookie

When verifying the jquery cookie plugin, it is only known that the original file has been placed on the desktop to perform the discovery is not effective, the file must be placed under the Web server execution will not take effect, the halo dish!

$.cookie (name,value,{expires:7,path: '/', Domin: ' jquery.com ', secure:true})
Detailed parameters:
expires:7,//a finite date, either an integer or a date (in days) if omitted, the cookie created is a session cookie that will be deleted when the user exits the browser. Path : '/',//cookie the saved path is the same as creating the page path by default domin: ' jquery.com ',//cookie domain property default range Create page path consistent secure:true//a Boolean value Indicates whether a security protocol is required to transmit a cookie

1. Read cookies

$.cookie (' The_cookie '); Get Cookie Value

2. Setting cookies

$.cookie (' The_cookie ', ' the_value '); Set cookies

3. Set cookie value with expiration date

$.cookie (' The_cookie ', ' The_value ', {expires:7}); Set cookies with time 7 days to save time

4. Delete Cookies

$.cookie (' The_cookie ', ', {Expires:-1}); Delete
$.cookie (' The_cookie ', null); Delete Cookies

5. Create a new cookie including the validity path domain name, etc.

$.cookie (' The_cookie ', ' The_value ', {expires:7, path: '/', Domain: ' jquery.com ', secure:true});

Notice to delete cookies:

@1.$.cookie (Name,null) when destroying a cookie, the path and domain name in its optional parameters must be the same as when it was set up or it cannot be destroyed

jquery Action Cookie

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.