i need to avoid the creation of the session in the application unless it is completely necessary.
I have noticed that xajax calls dont work properly if the session is not started :(. My first approach was to create the session (if it doesn't exist) at the begining of the xajax function, however, it doesn't work the first time the user invokes the call (it works the second time since the session was created).
There is any way to handle/fix this situation?
Edit: an example code:
function example ($parameters) {
if (!isset($_COOKIE["PHPSESSID"])) {
session_start(); // we create the session if it didn't exist previously
}
$response = new XajaxResponse();
.....
return $response;
}
My idea is to create the session when the user makes an ajax call. With this situation, the first time i call the "example" function it doesnt work. The second it goes ok, i think because the session was created.
EDIT: Hello, i have noticed a problem under chrome and explorer :(. The first ajax call is not received (i get not answer). Than means the user needs to click twice in order to receive the properly answer (with a popup for example)
Thanks!