[jQuery] Old cookie data sent in AJAX request?

[jQuery] Old cookie data sent in AJAX request?

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-GB link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>Hi all,<o:p></o:p>
<p class=MsoNormal>Having a bit of a strange problem and I’m not
altogether sure whether it’s jQuery related or something to do with the
awful, awful code it’s part of, but I thought I’d post up here to
see if I could get some help figuring that out <span style='font-family:Wingdings'>J</span><o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>I’ve got a webpage which has three cookies on it,
cart_id, user_data and user_other. Navigating around the pages and using the
Firefox Web Developer Toolbar shows these cookies are fine, one of each is set,
and they’re the correct values. <o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>If, however, I submit an AJAX post request to add a product
to the shopping cart on this site, it doesn’t work. Investigating the
AJAX behind this shows that two copies of every cookie named above is being
sent – the first copies have older and now incorrect data in them, and
are followed by the CORRECT data. Looks a bit like this:<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>cart_id=4a6b2bec89523599aa20a6ff7cc148f7;
user_data=12%7C; user_other=1; PHPSESSID=4c20e081a27ccba42a1f1009905f6f56<o:p></o:p></span>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>;
session_id=a56c7977d215631d6f9eebadab534089; user_data=5%7C424235235;
user_other=0; cart_id=4e77b0<o:p></o:p></span>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>044b97d0ba322a4641ee2fcf6b<o:p></o:p></span>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span>
<p class=MsoNormal>As you can see, cart_id, user_data and user_other are there
twice. PHP is evidently picking up the first copy of each cookie – the older,
incorrect ones – and using these. Meaning the products go into the wrong
cart and I’ve got myself a bit of a problem.<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>Has something like this ever happened to anyone else –
and was it something in your own code, or a weird jQuery glitch?<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>Because it will probably be relevant, we’re talking
about jQuery 1.2.6 here.<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>Regards,<o:p></o:p>
<p class=MsoNormal>Michael Price<o:p></o:p>
</div>
</body>
</html>