Ok I have a javascript cookie , and it work on current page of site (www.example.com/about.php), but on the index page of the site (www.example.com), it is not working. It says the cookie is not set.
I wana to display cookie value in another page. Any ideas?
Here is my code:-
in www.example.com/about.php page on click event of button:-
var cookievalue="testingCookie";
document.cookie="stateNcity=" + cookievalue;
var a=document.cookie;
alert(a);
and in www.example.com:-
<div id="abcd">click</div>
$("#abcd").on("click",function()
{
var cookie_string = document.cookie;
if (cookie_string.length !=0)
{
alert(cookie_string);
}
else
{
alert('cookie is not set');
}
});