I have a session_id which I am using to identify the user in a shopping basket type application.
The session_id is stored in the database as the session id.
When I update the cart, the session_id, product_id and qty are stored in the Basket table.
I am trying to add an item to the Basket, then show the updated basket on the screen without page refresh using jquery.
Do I store the session id in a hidden html field or is there a better way of getting jQuery to know what the session_id is?
UPDATE: Ok, so now based on answers and comments below, I don't really want to be using the session id in a hidden field. I certainly don't want to show the session id within the html page.
I may need to backtrack a little...
When ajax is calling my update basket function, I am faced with the following error...
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at ..... /ajaxData.php on line 105
The code I am using to start the session is...
if (!session_id()){
session_start();
}
I don't really understand what this warning means, so this is why I was thinking of sending the session id via the hidden html field.
I guess the solution is to fix what the warning was and try to do things properly...
Any suggestions on my warning message?