Reputation: 2160
Example: I have written a php script like below:
<?PHP
function _hello(){ "Hello world!"; }
function _bye(){ "Good Bye!"; }
function _night(){ "Good Night!"; }
?>
<html>
<head>!-- required files -- </head>
<body>
<div id="thisDIV">
<? echo _hello(); ?>
</div>
<div>
This is another Division.
</div>
</body>
</html>
Is it possible that I just want to reload the function _hello() in the division (id=thisDIV) by using javascript? Or ajax, Jquery ajax or whatever.. How can I make it? Thanks!
Upvotes: 0
Views: 65
Reputation: 1303
You could add a querystring to your URL and then tie that to what function you want to run:
eg: http://myurl.com/page.php?function=hello
In page.php:
$function = $_GET['function'];
if($function == "hello") {
hello();
}
etc etc
Upvotes: 2