Ciao a tutti:

index.php
Codice PHP:
<!DOCTYPE html>
<
html>
<
head>
<
script type="text/javascript" src="javascript/ajax.js"></script>
</head>
<body onLoad="showHint(this.value)">

<div id="query"></div><button type="submit" onClick="showHint(this.value);add(this.value)">aggiungi</button>

</body>
</html> 
ajax.js
Codice PHP:
//oggetto XMLHTTPRequest

function createObject() {
var 
request_type;
var 
browser navigator.appName;
if(
browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return 
request_type;
}

var 
http createObject();

//assegno un oggetto XMLHttpRequest
function assegnaXMLHttpRequest() {
            var
                
XHR null,
                
browserUtente navigator.userAgent.toUpperCase();
            if(
typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
                
XHR = new XMLHttpRequest();
            else if(
window.ActiveXObject && browserUtente.indexOf("MSIE 4") < 0) {
                if(
browserUtente.indexOf("MSIE 5") < 0)
                    
XHR = new ActiveXObject("Msxml2.XMLHTTP");
                else
                    
XHR = new ActiveXObject("Microsoft.XMLHTTP");
            }
            return 
XHR;
        };

function 
showHint(){
http.onreadystatechange=function()
  {
  if (
http.readyState==&& http.status==200)
    {
    
document.getElementById("query").innerHTML=http.responseText;
    }
  }
http.open("GET","query.php",true);
http.send();
}

function 
add(){
http.onreadystatechange=function()
  {
  if (
http.readyState==&& http.status==200)
    {
    }
  }
http.open("GET","insert.php",true);
http.send();


Con la funzione "showHint" carico in maniera dinamica dei record presenti i una tabella
Con la funzione "add" quando premo il pulsante aggiungi aggiungo un record a una tabella

Nel div "query" i record vengono estratti e qui tutto apposto,ma se clicco su aggiungi il record mi viene inserito nella tabella,ma non compare dinamicamente nella lista dei records...aggiornando la pagina lo trovo lì
Inizialmente avevo provato a mettere in onClick prima la funzione add e poi showHint,ma non funzionava...

Attendo consigli