I have a question to the behaviour of this AJAX call shown below which I dont understand.
var checkBoxes = document.getElementsByName("newInclCheckBox");
for(var i = 0; i<checkBoxes.length; i++
{
  if(checkBoxes[i].checked)
  {
    var name2 = getTabKeyFromDescription(checkBoxes[i].value);
    var tablenr2 = checkBoxes[i].getAttribute("data-tablenr");
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function()
    {
      if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
      {
        document.getElementById('newIncl_LogBox').innerHTML += xmlhttp.responseText;
      }
    }
    xmlhttp.open("GET", "../PHPScripts/getInclusions.php?q=add&name1=" + name1 + "&tablenr1=" + tablenr1 + "&name2=" + name2 + "&tablenr2=" + tablenr2, true);
    xmlhttp.send();
  }
}
As you can see, the AJAX Call is inside a for-loop and gets called several times while looping through checkBoxes. 
The PHP-Skript getInclusions.php completes each request successfully, but somehow only the last xmlhttp.responseText gets written in my LogBox. 
I would understand this behaviour if i had written
document.getElementById('newIncl_LogBox').innerHTML = xmlhttp.responseText;
(without += Operator). 
Why is the writing in the logbox not as expected? Any help is greatly appreciated!
 
    