I found something that almost works:
Code:
<script src="{vb:raw vboptions.bburl}/cache.php"></script>
<script>
alert('x = ' + testVar)
</script>
No AJAX necessary.
Since cache.php is a php file I can require global.php and set testVar to the userid. After logging out that value is preserved for a few refreshes and then for some reason it loads the file from the server and returns a userid = 0 as it should for a guest.
Does anyone know how the software would direct the browser to reload a cached file after several page refreshes? Or would that be a browser setting?