View Full Version : Ajax - load DB rows as available

03-01-2012, 06:12 AM
Hello, I am a php coder thats just breaking into ajax. I have used this code succesfully on many of my pages but i've come to a point where i need a little more

function loadUpdates()

if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
//loading animation
document.getElementById("updates").innerHTML="<image src=../../images/loading.gif></img>";

if (xmlhttp.readyState==4 && xmlhttp.status==200)


This code simply loads another page into a DIV. I'd like to know what or how to adjust this code to load my php page as there are new rows entered into the database. I briefly read about changing xmlhttp.open("GET","updates.php",true); to 'false' to make it asyncronous, a constant connection. But i'm unsure if this is true or the most efficient way to load data as it's entered into the DB.

Thanks~ :D