10 examples of 'get session value in jquery' in JavaScript

Every line of 'get session value in jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
53function getCookie(name) {
54 var re = new RegExp(name + "=([^;]+)");
55 var value = re.exec(document.cookie);
56 return (value != null) ? unescape(value[1]) : null;
57}
52function get(name) {
53 if (typeof (Storage) !== 'undefined') {
54 return localStorage.getItem(name)
55 } else {
56 window.alert('Please use a modern browser to properly view this template!')
57 }
58}
108static getSessionData(key: string): any {
109 const sessionStorage = BrowserStorage.getSessionStorage();
110
111 if(sessionStorage) {
112 try {
113 const item = sessionStorage.getItem(key);
114
115 if(item) {
116 return item ? JSON.parse(item) : null;
117 }
118
119 return null;
120 } catch(error) {
121 return null;
122 }
123 } else {
124 return null;
125 }
126}
23function get_cookie (key) {
24 var i = document.cookie.indexOf (key+'=');
25 if (i < 0) {
26 return;
27 }
28
29 i += key.length + 1;
30
31 var e = document.cookie.indexOf(';', i);
32 if (e < 0) {
33 e = document.cookie.length;
34 }
35
36 return unescape (document.cookie.substring (i, e));
37}
1function getCookie(key) {
2 var m = document.cookie.match(new RegExp('(?:^|;)\\s?' + key + '=(.*?)(?:;|$)'));
3 if (m) return m[1];
4}
1847function Get_Cookie(name) {
1848
1849 var start = document.cookie.indexOf(name + "=");
1850 var len = start + name.length + 1;
1851 if ((!start) &&
1852(name != document.cookie.substring(0, name.length))) {
1853 return null;
1854 }
1855 if (start == -1) return null;
1856 var end = document.cookie.indexOf(";", len);
1857 if (end == -1) end = document.cookie.length;
1858 return unescape(document.cookie.substring(len, end));
1859 }
311function getLocalStorage (currentControl, key) {
312 if (key in store) {
313 const stored = store[key];
314 if (!stored) return undefined;
315 if (currentControl.type !== stored.type) return undefined;
316 if (currentControl.value !== stored.defaultValue) return undefined;
317 // console.log('CHECK CHECK', key, currentControl.value, stored.defaultValue)
318 return stored.value;
319 }
320 return undefined;
321}
26function get_cookie(Name, CookieStr="") {
27 var search = Name + "="
28 var returnvalue = "";
29 if (CookieStr.length > 0) {
30 var sd = CookieStr.indexOf(search);
31 if (sd!= -1) {
32 sd += search.length;
33 var end = CookieStr.indexOf(";", sd);
34 if (end == -1){
35 end = CookieStr.length;
36 }
37 returnvalue = window.unescape(CookieStr.substring(sd, end));
38 }
39 }
40 return returnvalue;
41}
22function get_cookie(Name) {
23 var search = Name + "="
24 var returnvalue = "";
25 if (document.cookie.length > 0) {
26 offset = document.cookie.indexOf(search)
27 if (offset != -1) { // if cookie exists
28 offset += search.length
29 // set index of beginning of value
30 end = document.cookie.indexOf(";", offset);
31 // set index of end of cookie value
32 if (end == -1)
33 end = document.cookie.length;
34 returnvalue=unescape(document.cookie.substring(offset, end))
35 }
36 }
37 return returnvalue;
38}
6function get_cookie(name, default_value) {
7 var value = Cookies.get(name);
8
9 if(value !== undefined) {
10 return JSON.parse(value);
11 }
12
13 return default_value;
14}

Related snippets