AJAX example -- toward a two person game
This sends a (hopefully) unique id together with a user-provided string and is echoed
to the user.
The server-side program invoked here looks something like this:
<?
if (!isset($data)) $data="hello";
if (!isset($id)) $id=0000000000;
$idstring=$id." ".$REMOTE_ADDR;
echo "hello from granite: ".$idstring." ".$data;
$file="../gamelog";
$o=fopen($file, "a") or die ("couldn't open $outf");
fwrite($o,$idstring." ".$data."\n");
?>
See also
Mediating two person interaction)
and at game3.php in my granite account.