This is my list: The index.html code: <script language="javascript" src="ajax.js"></script> <script language="javascript"> http = getXMLHTTPRequest(); function generalista(){ var myurl = 'cliente_lista.php'; myRand= parseInt(Math.random()*99999999999999999); var modurl = myurl + "?rand=" + myRand; http.open("GET", modurl, true); http.onreadystatechange = useHTTPResponse; http.send(null); } function useHTTPResponse() { if (http.readyState == 4) { if(http.status == 200) { var miTexto = http.responseText; document.getElementById('listacliente').innerHTML = (miTexto); http.onreadystatechange = null; } } else { document.getElementById('listacliente').innerHTML='<img src="procesando.gif">'; } } </script> <body onLoad="generalista()"> <table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <div id="listacliente"></div></td> </tr> </table> </body> PHP: I want to display automatically all list when a new record was entered in data base, as when a chat window shows a new line.
Put a timer which e.g. every 5 seconds sends a AJAX request to PHP and get actual data... instead of <body onLoad="generalista()"> use window.setInterval('generalista()', 5000) inside your <script> tag