I have a PHP script that is called in two ways from a Dojo Ajax xhrGet call. The first time it is called with the argument "init", which causes the script to instantiate the StateList class and read in the state name file.
session_start();
@include('StateList.php');
require_once('phplog.php');
$comd=$_GET['nexturl'];
if($comd=="init") {
$st = new StateList("../data/statestxt.txt");
$_SESSION['statefile'] = $st;
}
A second or later time, another call to xhrGet passes the argument "getstate", and the following code tries to get an instance of the StateList class from the SESSION array.
if($comd =="getstate") {
$st= $_SESSION['statefile'];
phplog("size=".$st->getSize());
}
However, the getSize () method is never executed, and I cannot call any other method on the restored instance of the StateList class.
Please note that this is one PHP script that includes the class definition at the top and therefore class methods must be known and accessible.
What am I missing here?
James Cooper