xxxxxxxxxx
// This is in the PHP file and sends a Javascript alert to the client
$message = "Something";
echo "<script type='text/javascript'>alert('$message');</script>";
xxxxxxxxxx
<?php
alert("Hello World");
function alert($msg) {
echo "<script type='text/javascript'>alert('$msg');</script>";
}
?>
xxxxxxxxxx
echo '<script type="text/javascript">alert("'.$error.'");</script>';