whenever the ajax page is called, i run:
setcookie($filtersCookie, $cookieVal, time() + 86400); // 1 day
and when the page is refreshed, i use the following code to see if there were any past filters saved:
if(isset($_COOKIE[$filtersCookie])) {
but the cookie never exists after a page refresh. any ideas as to why this may happen?
setcookie is used before any browser output from the ajax call.
If your Ajax scripts resides in another directory than the calling page, then you should also use the
pathparameterBy default the cookie will be available from the directory the cookie is set on, using “/” will make it available to all paths.