title: In xmlhttp.onreadystatechange function, how do I pass the name of the ID I want to edit?
body: <p>Here's my code. See the line that is commented out. When the element id (which is a span) is hardcoded, it works. When the id is created by concatenating the variables passed into stateChanged, it does not work. Am I not allowed to pass variables in to stateChanged? What's wrong?</p>
  
  <pre><code>function multiplePassportPoints(id, counter)
  {
  xmlhttp=GetXmlHttpObject();
  if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
  var url="addmorepoints.php"; 
  url=url+"?id="+id+"&amp;c="+counter;
  url=url+"&amp;sid="+Math.random();
  
  xmlhttp.onreadystatechange=stateChanged(id,counter);
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
  
  function stateChanged(id, counter) 
  {
    if (xmlhttp.readyState==4)
    {
      //THIS WORKS (assuming id is 99 and counter is 5:
      //document.getElementById("99_5").innerHTML += xmlhttp.responseText; 
  
      //BUT I NEED IT TO WORK LIKE THIS:
      document.getElementById(studentID+"_"+counter).innerHTML += xmlhttp.responseText; 
    }
  }
  </code></pre>
  
  <p>Thanks!</p>