title: Using JSON to parse xmlhttp.responseText for populating textboxes
body: <p>How can JSON be used to parse xmlhttp.responseText? I can't seem to get textboxes populated using the parsed data. I tried using .value and .innerHTML with the dot notation with b.first and b.second used with json_encode from the loadTextBox.php file (see below), but the textboxes won't populate.</p>
  
  <p>Main page code:</p>
  
  <pre><code>function loadDoc()
  {
     var xmlhttp;
  
     // code for IE7+, Firefox, Chrome, Opera, Safari
     if (window.XMLHttpRequest)
     {
        xmlhttp=new XMLHttpRequest();
     }
     //code for IE6, IE5
     else
     {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
  
     xmlhttp.onreadystatechange=function()
     {
        if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
        {
           var doc = window.document.createElement("doc");
           var a = xmlhttp.responseText;
           var b = JSON.parse(a);
           document.getElementById("textbox").innerHTML=b.first;
           document.getElementById("textbox2").innerHTML=b.second;
        }
     }
  
     xmlhttp.open("GET","loadTextBox.php?id=4",true);
     xmlhttp.send();
  }
  </code></pre>
  
  <p>loadTextBox.php code:</p>
  
  <pre><code>&lt;?php
  ---Placeholder for correct DB login info---
  
  $result = $mysql-&gt;query("SELECT column_one FROM table_one");
  
  while ($row = $result-&gt;fetch_object())
  {
     $queryResult[] = $row-&gt;present_tense;
  }
  $textboxValue = $queryResult[0];
  $textboxValue2 = $queryResult[2];
  echo json_encode(array('first'=&gt;$textboxValue,'second'=&gt;$textboxValue2));
  ?&gt;
  </code></pre>