Which are the common scenarios where both can not use together ?
A:
If the call is through the same domain (example.com/index.php calls example.com/ajax.php) then it should be enough to call session_start() in both places and the user's session should be used.
Ólafur Waage
2010-05-28 12:34:13
A:
Be sure that all you script use the same domain, you can ensure that by positioning it before calling session_start :
session_set_cookie_params(0, "/", example.tld)
Serty Oan
2010-05-28 12:41:49
+5
A:
There is not much difference between AJAX requests and direct ones. Especially from the server-side point of view.
Your PHP script process a request and send out some data. It is really doesn't matter, who did that request - a browser itself or some JS object, running in the browser.
Frankly, AJAX just has nothing to do with sessions - it's PHP's realm
Col. Shrapnel
2010-05-28 12:42:20