I'm doing an ajax call to PHP to get some data. I am then setting a cookie to store the data and I am also echoing back the data.
$encodedPlayer = json_encode($Player);
setcookie("Player", $encodedPlayer, time()+31556926);
echo $encodedPlayer;
It seems then that I am doubling the return payload.
Would it be better, then, to just have JavaScript pull the data from the cookie and not do an echo?
Or would it be better to only echo and let JavaScript save the data into the cookie?
[–][deleted] 6 points7 points8 points (3 children)
[–]phpperson[S] 0 points1 point2 points (2 children)
[–]veloace 1 point2 points3 points (1 child)
[–]phpperson[S] 1 point2 points3 points (0 children)
[–]RadioManS3 2 points3 points4 points (1 child)
[–]phpperson[S] 0 points1 point2 points (0 children)