You can do like this, use jquery plugin, to do ajax and load result of script.php
to any section of your html page.
script.php
<?php
echo exec('date'); //type command to be executed here.
?>
page.html
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js" >
</script>
<script type="text/javascript">
$(document).ready(function(){
setInterval(executeScript,1000);
});
function executeScript(){
$("#result").load("script.php");
}
</script>
</head>
<body>
<div id="result"> command result will come here.. </div>
</body>
</html>
It will call script.php
at every second and its result will be shown in <div id="result"> </div>
You can also use jQuery ajax .post(), .get() or .ajax() to pass some argument to script and get response accordingly.