I want to call a PHP function from javascript, I know that´s impossible by natural ways, because PHP runs in the server and javascript in the client. I have heard that AJAX is used for this sort of function, and I wanna know if somebody could help me with the syntax. For example I wanna call the PHP function print from javascript:
<html>
<body>
<a href="#" onclick=js()></a>
</body>
</html>
<script type="text/javascript">
function js(){
//Call print function
}
</script>
<?php
function print(){
echo "Hello World";
}
?>