I want to execute a function in php that returns a string but I couldn't find a clear explanation.
I would really like if you could answer for this example.
this is my php file, hello.php:
<?php
function HelloWorld()
{
return "Hello!";
}
?>
and let's say this is my javascript in my HTML file
MainPage.html
<body>
<script type="text/javascript">
sayHello()
{
alert(/*This is where I want My php to call*/);
}
</script>
<input type = "submit" onclick="sayHello()"/>
</body>
What I am asking is how can I get my php and use functions in it succesfully
alert('<?php echo HelloWorld()?>');