problemer med flere XMLHttpRequests
jeg har to js functioner, som jeg kalder ved body onload showValue(45000002);Men det er ikke alle XMLHttpRequests der bliver udført og dem der bliver udført får alle værdien fra den sidste, hvad gør jeg forkert?
function getValue(inst,id)
{
if (id=="")
{
document.getElementById(id).innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(id).innerHTML=xmlhttp.responseText;
}
}
var url = "getCurrentValue.php?t=" + Math.random();
var params = "inst="+inst+"&component="+id;
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(params);
}
function showValue(inst)
{
getValue(inst,'nHeatingProcesValueZone1');
getValue(inst,'nHeatingProcesValueZone2');
getValue(inst,'nHeatingProcesValueZone3');
getValue(inst,'nHeatingProcesValueZone4');
getValue(inst,'nHeatingProcesValueZone5');
getValue(inst,'nHeatingProcesValueZone6');
getValue(inst,'nHeatingProcesValueZone7');
getValue(inst,'nHeatingProcesValueZone8');
getValue(inst,'nHeatingProcesValueZone9');
getValue(inst,'nHeatingProcesValueZone10');
getValue(inst,'nHeatingProcesValueZone11');
getValue(inst,'nHeatingProcesValueZone12');
getValue(inst,'nHeatingProcesValueZone13');
getValue(inst,'nHeatingProcesValueZone14');
getValue(inst,'nHeatingProcesValueZone15');
getValue(inst,'nHeatingProcesValueZone16');
}
