Let's say you have a file:
index.php
<head>
<?php
session_start();
$_SESSION['bar'] = "test" ;
?>
<script class = "include" src = "js.js"></script>
</head>
The java that runs makes an AJAX call to another page, tables.php. This builds a table using the .js file AJAX call for the data, the PHP file to get the data from the database, and also uses the index.php file to build the table (irrelevant).
The problem I am having is that I do not believe, on first attempt, the $_SESSION data makes it through the AJAX call to the tables.php file. I know this because (using a button) the data does in fact make it through the second time, or rather, once the SESSION ID seems to have remained. So I am wondering if there is some issue if you were to expect $_SESSION data to make it through to a PHP file that is called in an AJAX request.
tables.php
if(isset($_SESSION['bar'])){
$foo= $_SESSION['bar'];
echo $foo;
}
The first attempt, there is nothing coming back. The second attempt, it echoes correctly.
Thanks for any help.