Hi All,
Im hoping somebody could help me with this. Ajax is not my strongest point.
On a page I have a requirement to call 2 different php pages using ajax. this code works fine, but if i add another is seems to conflift and im insure how.
the calls are in different areas of the page.
Im hoping somebody could help me with this. Ajax is not my strongest point.
On a page I have a requirement to call 2 different php pages using ajax. this code works fine, but if i add another is seems to conflift and im insure how.
the calls are in different areas of the page.
Code:
<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>
Comment