Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
Ajax and sessions?

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
nimowy
New one
New one


Joined: 05 Dec 2007
Posts: 2

PostPosted: Wed Dec 05, 2007 7:14 pm    Post subject: Ajax and sessions? Reply with quote

Hi, I am having some problems accessing session data from ajax calls in an application I recently inherited. It's php and prototype, both of which I have very little experience with, so I could really use some help.

In my main page, index.php, I create a session, and have no problems accessing that session:
Code:
<?php
session_start();
$sis = session_id();
echo("Session ID is: $sis.");
...
?>


That spits out the session id just fine.

But on the *same* page, in the window.onload function of the javascript, it goes out and gets one of the divs of the page, as html. Here's the function that does that:

Code:
   function ajax_getdata(text_id, url, inputlist) {
      alert("In ajax_getdata!");
      var myAjax = new Ajax.Updater(
         text_id,
         url,
         {
            method: 'get',   
            parameters: inputlist,
            evalscripts:true
         });
   }


But the page that it calls - nextquestion.php, can't find the session id. It just says it's empty. Here is the code I put in there to try and find it:
Code:
<?php
.... ( html output)
echo 'Session ID is: ' . session_id();

session_id() just returns nothing.

Can anyone please give me some advice on this? I searched online and it appears most other folks are using sessions in Ajax just fine.

Thank you!

Pam
Back to top
View user's profile Send private message
nimowy
New one
New one


Joined: 05 Dec 2007
Posts: 2

PostPosted: Wed Dec 05, 2007 7:19 pm    Post subject: I figured it out Reply with quote

Okay, nevermind, I just figured it out. Apparently in php you have to call session_start() on every single page you want to use sessions in. Now it works!

Thanks anyways.... always good to see a forum for help like this!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert