Hi everyone,
I am trying to create a page which will display some users information on a google map. Google maps api inherently has support for XML and JSON, so I would like have some PHP code that generates the XML data, which is then retrieved by XMLHTTPREQUEST in Javascript. My question is; will I still be able to use session data even though the page was requested through javascript? I have given it a try and it seems as though I cannot retrieve my session, however after logging in (which generates the session) and then manually typing the address of the XML page, I also cannot retrieve the session.
Finally, I have another question. While im creating the XML page, it is not much more effort to also create RSS/ATOM feeds. However the feed info will be different for each user, so I need again to store session data, so generate the correct content. What will happen when the user navigates away from the website though? I know it is possible because Google Mail offers an Atom feed of your inbox which continues to update even if you navigate away from the web site. So how can I use sessions when generating my XML and RSS/ATOM feeds?
Thank you,
Tomas
Sessions and AJAX page requests...
Moderator: General Moderators
- andyhoneycutt
- Forum Contributor
- Posts: 468
- Joined: Wed Aug 27, 2008 10:02 am
- Location: Idaho Falls
Re: Sessions and AJAX page requests...
I routinely use $_SESSION values in my php to spit out responses to XML/JSON for AJAX requests. I can verify that it works. Make sure you're creating the session before your user navigates to an AJAX/php request and you should be fine. Hope this helps.
-Andy
-Andy