JQuery cookie is a good cookie plug-in. The general usage is as follows: $. Cookie ('name', 'value ');Set the cookie value and set the value of the name variable to value. $. Cookie ('name', 'value', {expires: 7, path: '/', domain: 'jquery. com',
Cookie operations in JavaScript
This article describes how to operate cookies in JavaScript, this article describes what are cookies, basic Cookie knowledge, common Cookie problems, two methods for clearing cookies, basic Cookie usage, and advanced
Example $. Cookie ('name', 'value ');
Set the cookie value and set the value of the name variable to value.
Example $. Cookie ('name', 'value', {expires: 7, path: '/', domain: 'jquery. com', secure: true });
Create a cookie including the Domain Name
Incorrect value occurred while using jquery to manipulate cookies:
The result is that cookies have four different properties:Name, content, domain, path
The code is as follows
Copy Code
$.cookie (' The_cookie '); Read
Example $.cookie (' name ', ' value ');
Sets the value of the cookie to set the value of the name variable to
Example $.cookie (' name ', ' value ', {expires:7, path: '/', Domain: ' jquery.com ', secure:true});
Create a new cookie including the
During asp.net development, Session and Cookie are often used at the same time to store some information. Session data will be found on the home of the script, and there are few Cookie-related information, so I would like to add it. The following is
Update:
I used the following content before. In fact, I used these two methods in my project.
// Obtain the cookie value function getcookie (name) {var arr = document. cookie. match (New Regexp ("(^ |; \ s *)" + name + "= ([^;] *) (; | $ )")); // I
Analysis of jquery read/write cookie operation instances,
This document analyzes the jquery read/write cookie operations. We will share this with you for your reference. The details are as follows:
Jquery cookie requires the following script
During asp.net development, Session and Cookie are often used at the same time to store some information. Session data will be found on the home of the script, and there are few Cookie-related information, so I would like to add it. The following is
Usage Analysis of the cookie method in thinkphp3.x, thinkphp3.xcookie
This document analyzes the usage of the cookie method in thinkphp3.x. We will share this with you for your reference. The details are as follows:
1. The cookie function is also a
This article mainly introduces the usage of the cookie method in thinkphp3.x, and analyzes common operation skills such as setting, obtaining, and deleting the cookie method in thinkPHP based on the instance form, for more information about how to
note the Cookie Path setting. If path: '/' is not set, the path is automatically set according to the directory. For example: http://www.xxx.com/user/, pathwill be set to '/user']
$. Extend ({/** 1. set the cookie value and set the value of the
(1) Respose objectOutput text information using the Response object:protected void Page_Load (object sender, EventArgs e){String message = "Hello, welcome to this website!" "; Response.Write (message);} Use Response object to implement Web page
Example $. cookie ('name', 'value ');Set the cookie value and set the value of the name variable to value.Example $. cookie ('name', 'value', {expires: 7, path: '/', domain: 'jquery. com', secure: true });Create a cookie, including the Domain Name
The JQuery cookie is a good cookie plugin, presumably using the following methodExample $.cookie (' name ', ' value ');Set the value of the cookie to set the value of the name variable toExample $.cookie (' name ', ' value ', {expires:7, path: '/',
The JQuery cookie is a good cookie plugin, presumably using the following methodsExample $.cookie (' name ', ' value ');Sets the value of the cookie to set the value of the name variable toExample $.cookie (' name ', ' value ', {expires:7, path: '/',
Basic usage of Jquery.cookie:
Include script after the JQuery library (unless you are packaging scripts somehow else):
Create Session Cookie:
$.cookie (' name ', ' value ');
Create expiring cookies, 7 days from then:
$.cookie (' name ', '
First introduce jquery.cookie.js
Jquery.cookie.js Address: http://plugins.jquery.com/cookie/
Action Document:
Https://github.com/carhartl/jquery-cookie#readme
Create cookies:
$.cookie (' name ', ' value ');Set the expiration date:
Set seven-day
Document. cookie = "userId = 828 ";To store multiple name/value pairs at a time, use semicolons (;) to separate them. For example:Document. cookie = "userId = 828; userName = hulk ";The names or values of cookies cannot contain semicolons (;),
The cookie scope in php. Setcookie (cookie name, value, scope) "Scope" "indicates that the COOKIE applies to all files under the ROOT directory." ROOT "indicates that the COOKIE applies to all files under the ROOT directory. setcookie (" cookie name
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.