Hi All,
At the minute I have a script, that ill post below, that simple echos out some information via ajax.
My question is, how do i get the update without using meta refresh and without clicking anything at all?
<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", "timer1.php" + str, true);
xmlhttp.send(null);
}
</script>
</head>
<body>
<meta http-equiv="refresh" content="1;url=ajax1.php">
<form action="">
<input type="hidden" id="txt1" onkeyup="showHint(this.value);" />
</form>
<p><span id="txtHint"></span></p>
</body>
</html>
<script type="text/javascript">
showHint("");
</script>
<?php
getConnection();
$SQL = "SELECT email FROM tbl_emailtest ORDER BY email ASC";
$result = mysql_query($SQL);
while ($row = mysql_fetch_array($result)){
echo $row['email'];
echo "<br>";
}
?>