ajax xmlhttp.responsetext problem
Posted: Mon Jun 14, 2010 1:00 am
On my website, i have a button which when clicked should fill 3 <div>s. The Divs all have separate IDs and are in different places on the page so i cant combine them into one. My problem is that the xmlhttp.responseText appears to be getting mixed up and writing the wrong responsetext in each <div>. There doesnt appear to be any particular pattern to this. It happens about 80% of the time.
Here's the code for one of the functions. The other 2 are identical except for the link and the div they update.
I have a feeling that the xmlhttp.responseText is getting mixed up. How can i clarify it to stop this happening?
I've changed the link variables so they're all different and it doesnt do it as often but if any of the responsetext is blank, they all go blank
Here's the code for one of the functions. The other 2 are identical except for the link and the div they update.
Code: Select all
function updatelist(round)
{
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }
else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("mailboxlinks").innerHTML=xmlhttp.responseText;
}
}
var thelink = "mailboxlinks.php?x=" + round;
xmlhttp.open("GET",thelink,true);
xmlhttp.send();
}I've changed the link variables so they're all different and it doesnt do it as often but if any of the responsetext is blank, they all go blank