Of course, PHP should be reading the Session ID from a cookie sent
along with the headers, so you might check to make sure that the
domain parameter for the cookie is originally being set in such a way
that the script you're calling through AJAX has access to read the
cookie. I've had similar problems working across subdirectories in
vanilla PHP.  Here's the link to the cookie parameters for sessions.
http://www.php.net/manual/en/function.session-get-cookie-params.php

Good luck!

--Tom

On Jan 20, 10:32 pm, Skilzat99X <aaron.michael.leon...@gmail.com>
wrote:
> Hello everyone.
>
> I was racking my brain for a few hours today over a problem pertaining
> to an AJAX call in jQuery.
>
> Basically, I have the user click an item in a <select> list. Upon
> clicking an <option> a .post request is sent to a script, which gives
> me some HTML data to be added to part of the page. That part works
> fine.
>
> But, the server-side script also stores a variable in the $_SESSION
> variable when it's called. But this is not stored in the clients
> session as I anticipated. It appears to be being stored in the server
> session or something.
>
> Yes, session_start() is at the top of all files.
>
> To test, I used print_r to output the whole $_SESSION variable in both
> my static script, and to be returned by the AJAX call. The main script
> outputs an entire slew of data stored in the $_SESSION variable, but
> the content of the returned HTML shows only the single element in the
> $_SESSION array that is set by that script.
>
> I also had both scripts output their session_id()'s, and they're both
> different. I attempted to use session_id() to set the ID of the AJAX
> script to that of the main script (by sending the session_id as a
> variable to the AJAX script, of course), but that didn't help either.
>
> I couldn't figure out why this isn't working. Any help would be
> greatly appreciated. Thank you!

Reply via email to