aarontan78
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by aarontan78
-
-
Hi all AJAX gurus
Althought there are a lot of tutorials on retrieving data using ajax, I cant find any tutorial on how to display UPDATED records AUTOMATICALLY from mysql without having user to do onclick. Can someone enlighten me?
Thanks
-
Hi gurus
I have 2 buttons in my html. I would like to my mouse cursor to pont to the second button when I click the first button. Can I acgieve this using javascript?
Thanks
-
Hi all,
I'm new to javascript.
Is it possible to move the mouse cursor to a button in a webpage automatically when I open the page?
Can I use the mouse right click to execute a javascript function?
How can I do these?
Thanks and regards.
mysql display with AJAX
in Javascript Help
Posted
I have found the below code and modify a bit..somehow, it didn display the updated records.
Can someone knows what the problem with below coding?
connect.inc is the database connection and the page itself is saved as 'test.php'
Thanks.
<html>
<head>
<script type="text/javascript">
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == 'Microsoft Internet Explorer') {
ro = new ActiveXObject("Microsoft.XMLHTTP");
} else {
ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function sndReq(action) {
http.open('get', 'test.php');
http.onreadystatechange = handleResponse;
http.send(null);
}
function handleResponse() {
if(http.readyState == 4) {
var response = http.responseText;
document.getElementById('foo').innerHTML = response;
}
}
setInterval('sndReq()', 1);
</script>
</head>
<body>
<div id="foo">
<?php
include("inc/connect.inc");
$q1 = "SELECT EVENT_DESC FROM EVENTS";
$r1 = mysql_query($q1);
$EVENT_DESC = mysql_result($r1,0,0);
echo $EVENT_DESC;
?>
</div>
</body>
</html>