jquery - JavaScript reading cookie not working -
I've been searching cookies for the last several hours and posted questions in this site but there is no luck yet .
I just have to set a cookie on one page and read the cookie on other pages. I tried to escape and unsecope, but no results.
This is the first code where I am setting cookies
document.cookie = 'province =' + window save ($ (elem) .text ()) + '; Expiry of = Fri, 3 December 2014 20:47:11 UTC; Path = / '; And here I am reading
function then () {var a = get_cookie ("province"); Warning (a); Window.location = "lp.aspx?" + A; } Get_cookie (cookie_name) function {var results = document.cookie.match ('(| | | |)?' + Cookie_name + '= ([^;] *) (| | $)'); If (results) return (window.unescape (result [1])); And tap return; } I have tried all the replies on the stack overflow but still looking for solution.
Then I have to set a cookie on a page and read it on the second page. / P>
Try using the following
var testcookieValue = $. Cookie ("testcookie"); // read $ .cookie ("testcookie", 1); // write Hope it helps.
Comments
Post a Comment