Hi i am getting this strange problem. I am setting a cookie in external javascript file with current user time. I want this time to be available to the server so i am retrieving this using a php cookie.
I am able to fetch the value but only if i refresh the browser 2 times. If i change my current system time, and then refresh the page i still see old time,but when i refresh again then i see updated time.
I am doing something like this: enter code here
External js file
var now=new Date();
currTime=now.getHours();
document.cookie = "currentTime = " +currTime;
module file
$current_time = $_COOKIE["currentTime"];
echo $current_time;
I am calling the external js file in hook_nodeapi() using drupal_add_js
As I said, I am able to get the updated value of current time from cookie but only if I refresh 2 times.
What could be the problem?
thanks