title: Javascript only execute the last function called
body: <p>I want my page to execute the same function 3 times, calling for 3 different things each time.</p>
  
  <p>The code is currently</p>
  
  <pre><code> &lt;script&gt;
   ajaxGet('/goget.php?name='+edit.dep.value, 'dep_result');
   ajaxGet('/goget.php?name='+edit.arr.value, 'arr_result');
   ajaxGet('/goget.php?type='+edit.reg.value, 'reg_result');
   &lt;/script&gt;
  </code></pre>
  
  <p>But it only executes the last call. Why?</p>
  
  <p>Javascript:</p>
  
  <pre><code>var XMLHttpRequestObject = false;
  
  if (window.XMLHttpRequest) {
  
  XMLHttpRequestObject = new XMLHttpRequest();
  
  } else if (window.ActiveXObject) {
  
  XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  function ajaxGet(ajaxLoadData, changeToID) {
  
  if(XMLHttpRequestObject) {
  
      var obj = document.getElementById(changeToID);
      XMLHttpRequestObject.open("GET", ajaxLoadData);
      XMLHttpRequestObject.onreadystatechange = function() {
  
      if (XMLHttpRequestObject.readyState == 4 &amp;&amp; XMLHttpRequestObject.status ==     200) {
  
          obj.innerHTML = XMLHttpRequestObject.responseText;
  
      }
  }
  
      XMLHttpRequestObject.send(null);
  
  }
  }
  </code></pre>