Hi rashmi_k28 ,
Am new in php, but am good at ajax,
Try this,
Save this code as a new php page and call it time.php or any other name.
<?
$name = Names(1);
array_shift($name);
$time_val = $name[0];
// make sure u echo $time_val
echo $time_val;
?>
now, do this to the page that is viewed by the client
<html>
<head>
<script type="text/javascript">
var xmlhttp;
function getHTTPObject() {
xmlhttp = null;
try{
xmlhttp = new XMLHttpRequest();
}
catch(e){
try{
xmlhttp = new ActiveXObject('Msxml.XMLHTTP');
}
catch(e){
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
}
return xmlhttp;
}
function changeDiv(){
xmlhttp = getHTTPObject();
if(xmlhttp == null){
alert('Browser does not support HTTP Requests');
return;
}
var url = "time.php";
xmlhttp.onreadystatechange = displayTime;
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
}
function displayTime(){
if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete'){
document.getElementById('time').innerHTML = http.responseText;
}
}
function timing(){
window.setInterval("changeDiv()",60000);
}
</script>
</head>
<body onload="timing()">
<div id="time"></div>
</body>
Try it.