title: ajax, how to change two divs using one ajax request?
body: <p>how to change 2 divs using one ajax request ?</p>
  
  <p>ajax-update.php</p>
  
  <pre><code>&lt;?php
  include("config.inc.php");
  include("user.inc.php");
  $id = $_GET['id'];
  $item = New item($id);
  $result = $item-&gt;iteminfo;
  echo $result-&gt;name."&lt;br /&gt;";
  unset($item); 
  ?&gt; 
  </code></pre>
  
  <p><strong>html:</strong></p>
  
  <pre><code>&lt;tr&gt;
  &lt;td&gt; (one) &lt;/td&gt;
  
  &lt;td&gt;&lt;input type="text" value="" onchange="showUser&lt;?php echo $x;?&gt;(this.value)"  style="width:70px;"/&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;span id="txtHint&lt;?php echo $x;?&gt;"&gt;&lt;/span&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;input type="text" value="" name="price_&lt;?php echo $x;?&gt;" id="price_&lt;?php echo $x;?&gt;"  onchange="upperCase&lt;?php echo $x+$h;?&gt;()" style="width:40px;"/&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;input type="text"  id="proce_&lt;?php echo $x;?&gt;" style="width:70px;" value="&lt;?php echo $x+$h;?&gt;" disabled /&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;input type="text" value="" name="price_&lt;?php echo $x;?&gt;"   style="width:40px;"/&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;input type='text' id="totalPrice&lt;?php echo $x;?&gt;" disabled /&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  </code></pre>
  
  <p><strong>script:</strong></p>
  
  <pre><code>function showUser&lt;?php echo $x;?&gt;(str)
  {
  if (str=="")
    {
    document.getElementById("txtHint&lt;?php echo $x;?&gt;").innerHTML="";
    return;
    }
  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("txtHint&lt;?php echo $x;?&gt;").innerHTML=xmlhttp.responseText;
      }
    }
  xmlhttp.open("GET","ajax-update.php?id="+str,true);
  xmlhttp.send();
  }
  </code></pre>
  
  <p>my question is, when i change this value</p>
  
  <pre><code>&lt;td&gt;&lt;input type="text" value="" onchange="showUser&lt;?php echo $x;?&gt;(this.value)"  style="width:70px;"/&gt;&lt;/td&gt;
  </code></pre>
  
  <p>not only this td</p>
  
  <pre><code>&lt;td&gt;&lt;span id="txtHint&lt;?php echo $x;?&gt;"&gt;&lt;/span&gt;&lt;/td&gt;
  </code></pre>
  
  <p>but also this td</p>
  
  <pre><code>    &lt;td&gt;&lt;input type="text"  id="proce_&lt;?php echo $x;?&gt;" style="width:70px;" value="&lt;?php echo $x+$h;?&gt;" disabled /&gt;&lt;/td&gt;
  </code></pre>
  
  <p>now i only can change one div (txtHint) on the fly,</p>
  
  <p>sory for my english.</p>
  
  <p>note :
  i want to put un update with diferent file,
  for example when value change, this script is word</p>
  
  <pre><code>xmlhttp.open("GET","ajax-update.php?id="+str,true);
  </code></pre>
  
  <p>and the other one is</p>
  
  <pre><code>foo.php
  </code></pre>
  
  <p>thanks</p>
  
  <p>angga</p>
  
  <p>EDIT 1:</p>
  
  <p>[1] | [2] | [3]</p>
  
  <ul>
  <li>[1] : i input value manualy </li>
  <li>[2] : this span txtHint change using ajax</li>
  <li>[3] : i want this change too same as [2]</li>
  </ul>
  
  <p>EDIT 2 :</p>
  
  <pre><code>document.getElementById("txtHint&lt;?php echo $x;?&gt;").innerHTML=xmlhttp.responseText;
  document.getElementById("proce_&lt;?php echo $x;?&gt;").value=xmlhttp.responseText;
  </code></pre>
  
  <p>thats is work,
  but value in [2] and [3] is same, because it take from one file ajax-update.php
  how to add other file but still in one ajax request ?</p>