abdelelbouhy Posted October 26, 2010 Share Posted October 26, 2010 hello guys i'm trying to read cookies and here is the functionfunction getCookie(searchName){ var cookies = document.cookie.split(';'); for(var i=0; i < cookies.length;i++){ var cookieCrumbs = cookies.split('='); var cookieName = unescape(cookieCrumbs[0]); var cookieValue = unescape(cookieCrumbs[1]); if(cookieName == searchName){ return cookieValue; } } return false; }the problem is when i run it the first time for example to get the userName it return the value and it's right but when i change the cookie name it return false i checked the names and the values of the cookies using alert and it shows they are there for example cookie nam age it's there but whe i seach for it getCookie('age') it return false only the first cookie(userName) returns its valueplease help Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.