allora così come passi la query puoi passare un parametro id quindi (scrivo il codice di getto guzrdala coem traccia per capire cosa intendo niente più... :P)
codice:
function mostra(idx,str)
{
document.getElementById("progress"+idx).style.display = "block";
var url = "pagina.php?sid=" + Math.random() + "&q=" + str + "&dest=" + idx;
xmlHttp = GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}
in questo modo al file php arrivano 3 parametri.. sid, q e il nuovo dest.
nel file php aggiungi semplicemente un header..
Codice PHP:
header('dest: '.$_GET['dest']);
in questo modo il php non fa nientr'altro che ripassarlo al js quindi..
codice:
function stateChanged()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200 || xmlHttp.status == 0)
{
var dest = document.getElementById(xmlHttp.getResponseHeader('dest')); /* TODO verifica se è nullo ecc..ecc.. */
dest.innerHTML=xmlHttp.responseText;
dest.style.display = "block";
document.getElementById("progress").style.display = "none";
} else {
alert("errore");
}
}
}
Se cerchi qualcosa su getResponseHeader vedi degli esempi fatti bene e chiari..
Ciao
PS: in questo modo generalizzi la chiamata.. sbaglio o mancano un sacco di punti e virgola nel codice? bhoo