I need to update a cookie. I do that in a php file called via ajax. This is is the code:
setcookie(\'items[\'.$_POST[\'id\'].\']\');
The cookie
When you use setcookie is doesn't add the cookie to the superglobal $_COOKIE. You will have to do that yourself or reload the page. Also, since you are setting the cookie with an empty value, nothing would be set.
setcookie
$_COOKIE