title: Get multipe response using AJAX and PHP
body: <p>Is it possible to get multiple responses using AJAX and PHP?</p>
  
  <p>The event triggered by a select box and when it changes value (<code>onchange</code>) it calls the JavaScript function and get <code>xmlhttp.responseText</code>.</p>
  
  <p>But on <code>responseText</code> we can only change one value/innerHtml based on id.
  I want to change 2 or more HTML using AJAX. Is it possible?</p>
  
  <p>Here is my AJAX function:</p>
  
  <pre><code>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 &amp;&amp; xmlhttp.status == 200) {
          document.getElementById("txtStockQTY"+baris).value = "Validating..";
      }
      else if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
          document.getElementById("txtStockQTY"+baris).value = xmlhttp.responseText;
      }
  }
  
  xmlhttp.open("GET", "ajaxGetStock.php?id="+id, true);
  xmlhttp.send();`
  </code></pre>
  
  <p>And <code>ajaxGetStock</code> follows:</p>
  
  <pre><code>$idbarang = $_GET['id'];
  include "../connect.php";
  
  $resultSetStockType = mysql_query("SELECT STOCK_QTY,STOCK_QTYUNIT,STOCK_SIZE,STOCK_SIZE2 FROM TSTOCK WHERE STOCK_ID = $idbarang",$con);
  
  if($resultSetStockType and mysql_num_rows($resultSetStockType) &gt; 0) {
      while($rowSetStockType = mysql_fetch_array($resultSetStockType)) {
          echo $rowSetStockType['STOCK_QTY']." ".$rowSetStockType['STOCK_QTYUNIT'];
      }
  }
  else {
      echo "--- stok tidak ditemukan ---";
  }
  </code></pre>
  
  <p>I want to get several return values from my AJAX and assign it to several inputs of type text.</p>