[Javascript] AJAX + Cookies
Matt Warden
mwarden at gmail.com
Mon Jun 16 15:41:49 CDT 2008
On Mon, Jun 16, 2008 at 4:36 PM, Philip Thompson <philthathril at gmail.com> wrote:
> Hi all.
>
> I've been hitting my head against the wall for a while now. I've
> gotten a few hits from Google, but nothing has really answered my
> question:
>
> After updating the value of a cookie during an AJAX request, can that
> value be immediately accessed via the cookie (w/o a new request)?
>
> [js]
> alert(readCookie('mycookie'));
> updateCookie('mycookie', 'newValue');
> alert(readCookie('mycookie'));
> [/js]
You need to be reading the cookie value of the document returned in
the AJAX response. It will not update the document.cookie where
document refers to the containing document which issued the AJAX
request.
Hope that helps,
--
Matt Warden
Cincinnati, OH, USA
http://mattwarden.com
This email proudly and graciously contributes to entropy.
More information about the Javascript
mailing list