AJAX, JSON, IE & Cookies...?

AJAX, JSON, IE & Cookies...?

Hi - first let me start by saying that what I want to achieve is not at all malicious, but I understand how it could potentially be used this way.

- We run about 20 sites and a shop.  Most of the sites contain common content (header and footer).
- The shop stores a user's cart summary in a cookie
- I have written an ASP page to write the cart summary to the browser in JSONP format.  I know it's ASP, but it does the job
- I have a piece of JQuery on the other sites that polls the JSON cart summary, and updates the html of a shop link if their cart is not empty
- The code works fine in Chrome and Firefox, but not IE.  If I visit the ASP page directly in IE, the contents of the cart are correct, but through AJAX, the cart is always empty (suggesting that the cookie is not available
- I'm currently using AJAX rather than getJSON after looking into potential caching issues.  This has made no difference

Any ideas?

A few thoughts...
- IE is caching an empty cart.  Not so, turned caching off and changed the ASP page's output.  Returned code was different, but cart still empty
- When IE uses AJAX it might show up as a different browser, and hence no cookie is available.  This is the one I am concentrating on at the moment, but my knowledge is limited such that I'm not sure where to look next.

My code...

On the shop
  1. <%
  2. Response.Expires = -1
  3. itemCount = 0
  4. totalPrice = "£0.00"
  5. cookie = Request.Cookies("CART_CONTENT")
  6. If cookie <> "" then
  7. cookieArray = Split(cookie," ")
  8. itemCount = Trim(cookieArray(3))
  9. If itemCount <> "" then itemCount = Replace(itemCount,Chr(10),"")
  10. totalPrice = Trim(cookieArray(1))
  11. If totalPrice <> "" then totalPrice = Replace(totalPrice,Chr(10),"")
  12. End If
  13. data = "{""itemCount"" : """ & itemCount & """, ""totalPrice"" : """ & totalPrice & """}"
  14. Response.Write Request.QueryString("jsoncallback") & "(" & data & ");"
  15. %>
The JQuery...

  1.     $.ajax({
  2.       url: 'http://myshop.url/basket_json.asp?jsoncallback=?',
  3.       dataType: 'jsonp', 
  4.       cache: false,
  5.       success: function(data) {
  6. var itemCount = data.itemCount;
  7. if(itemCount>0) {
  8. $('#shopLink').append("<strong> ("+itemCount+", "+data.totalPrice+")</strong>");
  9. }
  10.       }
  11.     });

Many apologies if I have made some very basic errors, but I'm just getting started in the whole AJAX/JSON area, and I'm not quite up to speed yet.  All help very gratefully appreciated.