Link to home
Create AccountLog in
Avatar of rivkamak
rivkamakFlag for United States of America

asked on

ajax to asp page with cookie

I have a shopping cart where I am trying to save items someone puts in through a database.
I am using ajax on each change to send the data out.
On the first time I insert for that person after the insert statement I save the ID as a cookie. Then when they continue, if that cookie exists I update the database instead of insert.

It all works fine in firefox and internet explorer.
For some strange reason, chrome is running my script because the information is going into my database, but it is not saving the cookie.

I don't have any good reason to believe chrome isn't saving any cookies, becuase i don't have problems on anyone else's site.

 What might be wrong in my code?
    MM_editCmd.Execute
	
MM_editCmd.CommandText = "SELECT @@IDENTITY AS NewID"
Set loRs = MM_editCmd.Execute()
llID = loRs.Fields("NewID").value
response.Cookies("auctionsession") = llID
Response.Cookies("auctionsession").Expires = Date() + 15

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of rivkamak

ASKER

This is the cookie data in firefox:
auctionsession
26
      www.oorah.org      
16 B      
/      
Monday, November 26, 2012 9:59:57 PM
Value
26

I put a straight response.cookie("temp") on the page and it ran just fine in chrome.
So chrome could get the cookie , something must be wrong with the script on top.
I'll make the question  a bit more complex.
 I tried setting a session variable right under the cookie
session("auctionsession") = llID

yet, that doesn't happen either.
For some reason chrome stops running the script right after the execution to the database.
Have you looked in the Chrome Javascript Console (Ctrl-Shift-J) to see if there is an error message?
Halt!  Stop!  ASP VBscript executes on the Server, not in the Browser.  Chrome can not stop it from executing.  No browser can.
I understand that it does not make any sense logically, so what else might be happening here!
I'm so confused.
Start with identifying what does work.  There is no reason that the server side code should act any differently with different browsers.  You are setting a cookie.  What does your server code do with the cookie?