News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

$_SESSION Lost on AJAX Call

Started by ziycon, February 27, 2014, 07:04:52 AM

Previous topic - Next topic

ziycon

I'm having a very strange issue, I create an object of class 'Dog' lets say and when the object is created there is a check to see if a session variable exists, if not it's created, this is ok and expected. Next the data retrieved via the object is loaded into a div initially on page load, from then on there is a AJAX call every 5 seconds to update the div. The AJAX call creates a new object of the same class and makes a call for the same data, so if there is any new data it's displayed every 5 seconds, this is all working grand and there are no issues with this part.

The problem is related to the session variable that's created when a function is called based on the object in created on the AJAX call, on my local dev machine the session variable is maintained regardless of page load or the ajax call and is accessible to both as would be expected. But when I load the files onto my web server the session variable is being set on every AJAX call which shouldn't be the case.

Advertisement: