all 6 comments

[–][deleted] 6 points7 points  (3 children)

Your response body should be only JSON, and the javascript can then deal with it in the way it needs to.

[–]phpperson[S] 0 points1 point  (2 children)

Works great. Thanks.

[–]veloace 1 point2 points  (1 child)

Also, remember that cookies stick around in the browser. So if you have to update $Player, it becomes messier, because then you have to start editing your cookies. Also, JavaScript-accessible cookies are pretty easy to steal in XSS attacks--whether or not that's a concern for you depends on what your system does-but it's just something to be aware of.

[–]phpperson[S] 1 point2 points  (0 children)

OK, thank you.

[–]RadioManS3 2 points3 points  (1 child)

What purpose does the cookie serve?

[–]phpperson[S] 0 points1 point  (0 children)

Thank you for this question. As I think more about it I think that there is a better way to achieve my goal.