title: display value in two text box using xmlhttprequest object?
body: <p>I have posted the code below.
  there are two files..</p>
  
  <ol>
  <li>getvendorname.php</li>
  <li>sales.htm (containing the javascript function)
  Here what i am did is when blur i need to retrieve the values without page reload from getvendorname.php and show the vendor name and id in the different textbox.<br>
  Here i have to store the values into different textbox retrieved from database with the use of xmlhttprequest object.Here the values are retrieved,but i can't store into the different textbox.Its working,but it shows like this
  o/p:201anne.I need to display vendor id and vendor name on different textbox.please help me                </li>
  </ol>
  
  <p>sales.htm</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  function getname()
  {
    var vendorID = document.getElementById("idvid").value;
    var xmlhttp;
    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("iddiv1").innerHTML=xmlhttp.responseText;
              document.getElementById("iddiv2").innerHTML=xmlhttp.responseText;
          }
      }
      xmlhttp.open("GET","getvendorname.php?vendorid="+vendorID,true);
      xmlhttp.send();
  }
  &lt;/script&gt;
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;vendor info&lt;/title&gt; &lt;/head&gt;
    &lt;body&gt;
      &lt;td&gt;Vendor Primary ID:&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" id="idvid" name="vendor_primary_number" onblur="getname()"&gt;
      &lt;/td&gt;
      &lt;td&gt; &lt;div id="iddiv1"&gt; &lt;/div&gt;&lt;/td&gt;
      &lt;td&gt; &lt;div id="iddiv2"&gt; &lt;/div&gt;&lt;/td&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>getvendorname.php</p>
  
  <pre><code>&lt;?php
  $vid = $_GET['vendorid'];
  
  $connection = mysql_connect('localhost','root','root');
  mysql_select_db('bgm_score', $connection);
  
  $r ="select vendorid,vendorname from vendor_info where vendorid ='$vid'";
  $result = mysql_query($r, $connection);
  
  $row = mysql_fetch_assoc($result);
  echo $row["vendorid"];
  echo $row["vendorname"]; 
  
  ?&gt;
  </code></pre>