jcanker Posted February 22, 2010 Share Posted February 22, 2010 After much pre-planning, I'm getting ready to start my first foray into AJAX, but I have one question first that will affect my planned scripts: I prefer to have all of my html outputted via php rather than sneak php variables into the html. In other words, as the php script unfolds, it builds $output as it goes, and the last step of the script is to echo $output. I plan to keep doing this with the pages utilizing html and javascript when I turn to AJAX, but if the php script called forth via AJAX has a session_start(), will it use the same session already in use, or will I essentially be confusing the system and starting 2 separate sessions? I hope my intent was clear. Basically, a php page runs security scripts and such before building the html containing the javascript. When AJAX sends an async call to another php page which also runs some security scripts and such, can that called php page use the same session variables or will it be starting a separate session and getting confuzzled? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 22, 2010 Share Posted February 22, 2010 As far as the web server is concerned, the http requests that AJAX makes are identical to the http requests due to clicking on a link or typing a URL into your browser's address bar. Your browser will send any cookie/session id cookie that is valid, has not expired, and matches the URL/page being requested with any http request that is made via AJAX or any other method. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.