Hi All,
the following code is used to get an update from a database. My question is how can I use this more than once on a page to call two different queries (from different php files)?
<html>
<head>
<script type="text/javascript">
function showHint(str)
{
if (window.XMLHttpRequest)
xmlhttp = new XMLHttpRequest();
else
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
};
xmlhttp.open("GET", "console4.php" + str, true);
xmlhttp.send(null);
}
</script>
</head>
<body>
<script type="text/javascript">showHint(this.value)</script>
<p><span id="txtHint"></span></p>
</body>
</html>
<script type="text/javascript">
function keepCalling() {
showHint("");
window.setTimeout("keepCalling()", 2000) ;// call the showHint every (2)000 second
}
keepCalling();
</script>