This question already has an answer here:
- Jquery load() and PHP variables 6 answers
Assuming my example.php looks like this:
<?php $variable = "I am a variable"; ?>
and on another page I have:
How can I get that variable to my div?
Can it be achieved by using
I can imagine could be something like this:
Am I even close?
You're close, you need to echo the variable in the PHP file -
<?php $variable = "foo"; echo $variable; ?>
Then load like this -
The content of
#loadme will now be 'foo'.
EDIT: Based on the OP's comments -
Each echo containing a variable could be a div with an id, e.g.,
echo '<div id="foo">$variable</div>';
Then your load statement would look like this -