0

I have 2 websites, on different servers. website1.com and website2.com

I am trying to set a cookie for website2.com on website1.com using ajax.

run.php

header("Access-Control-Allow-Origin: *");
setcookie("cook", "test", time() + (86400 * 30), "/");
echo $_COOKIE["cook"];

Error: Undefined index: cook

My cookie is not being set.

When running website2.com/run.php directly this works but not with ajax.

0 Answers0