Skip to content

Instantly share code, notes, and snippets.

@Attaulla9
Created December 28, 2021 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Attaulla9/5fd0f0ddb8980606697cb91a96f396b0 to your computer and use it in GitHub Desktop.
Save Attaulla9/5fd0f0ddb8980606697cb91a96f396b0 to your computer and use it in GitHub Desktop.
We can check and get if cookies are available
var isCookiesExist = false;
var parse_cookie;
if (document.cookie.indexOf('fordata=') != -1) {
isCookiesExist=true;
var cookiedata = document.cookie
.split('; ')
.map(cookie => cookie.split("="))
.reduce((accumulator, [key, value]) => (
{ ...accumulator, [key.trim()]: decodeURIComponent(value) }
), {});
parse_cookie = JSON.parse(cookiedata.fordata)
var cookieName=parse_cookie.data_name;
var cookiePhone=parse_cookie.data_phone;
var cookieCourse=parse_cookie.course;
var cookieEmail=parse_cookie.data_email;
}
var bmiName = cookieName != null || cookieName != "null" || cookieName != undefined ? cookieName : urlParams.get('data_phone');
var phn = cookiePhone != null || cookiePhone != "null" || cookiePhone != undefined ? cookiePhone : urlParams.get('data_phone');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment