Sorry if the title is inaccurate, but I need help syncing a variable across two pages, when the second is loading with ajax (Instant Messanging)
I need it to fetch a page with ajax, just if I define a variable earlier on in the same document it doesn't apply to the ajax page (I can't use include
)
page1.php
<?php $variable = 'apples'; ?>
<script src="script.js"></script> <!--Contains ajax for page2.php-->
<div id="gets_parsed_here"></div>
And it uses ajax to get page2.php
page2.php
<?php echo $variable; ?>
This isn't my actual code, but it's similar to what it should do.
Any help would be appreciated a lot.