nmullen Posted November 5, 2008 Share Posted November 5, 2008 I'm running two scripts asynch ( I believe ) so one script can update a session variable based on how complete it is while the other checks and returns it to the javascript/AJAX. However, the problem I'm running into is when my second script checks the session variables and returns it to the AJAX all i get are null variables. Here's the part where i'm setting my session variables and incrementing: session_start(); for($i=0;$i<10; $i++) { $progress+= 100/($KWLength * 10); //KWlength is already defined and through testing i always have it = to 1 $_SESSION['progress'] = $progress; } session_destroy(); This is my secondary script which runs Asynch ( I THINK) with the above one "getProgress.php" <?php //Grabs the progress variable session_start(); echo $_SESSION['progress']; ?> Here's my javascript/Ajax which automates the progress (at the moment i'm just trying to increment a %). Once a button is clicked an interval is set which calls progressBar every 100 milliseconds. function progressBar() { //progxmlHttp is defined as a global progxmlHttp = getSingleXMLHttpObject(); var url = "_includes/getProgress.php"; progxmlHttp.onreadystatechange = progressChange; progxmlHttp.open("GET", url, true); progxmlHttp.send(null); if (progress >= 100) { alert("Progress done!"); clearInterval(interval); } } function progressChange() { if (progxmlHttp.readyState == 4) { progress = progxmlHttp.responseText; document.getElementById("ProgressPercent").innerHTML = (Math.round(progress*1000)/1000) + "%"; } } I've double checked all my code and I believe that this should be working. Why am I getting null values from my session variables? Are my AJAX functions not properly making requests to the server? My javascript function are attached (as a .txt) which automate all of this I apologize for all of the extra script in my javascript functions, I write a lot of different functions for testing purposes. Thanks in advance! [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
nmullen Posted November 6, 2008 Author Share Posted November 6, 2008 bump, any help ? I still can't figure this bad boy out! Quote Link to comment Share on other sites More sharing options...
corbin Posted November 6, 2008 Share Posted November 6, 2008 http://php.net/session_destroy Why would you destroy the session? Quote Link to comment Share on other sites More sharing options...
nmullen Posted November 7, 2008 Author Share Posted November 7, 2008 Ya i'm not quite sure why i was destroying that variable! hah. The problem ended up being that one of my session variables was declared screwy. Thanks corbin! 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.