title: Ajax request for each row in a table via PHP
body: <p>I am looking to execute an ajax request for each row displayed from a table.</p>
  
  <p>Any chance someone could show me some code how this is possible? I have searched Google but can't seem to find anything all. I am really looking for is to  fetch a result from a MySQL table. </p>
  
  <pre><code>&lt;table&gt;
    &lt;tr&gt;&lt;td&gt;this should have ajax request&lt;/td&gt;&lt;td&gt;ajax result&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I have the following code to request the data:</p>
  
  <pre><code>function showUser(str) {
      if (str == "") {
          document.getElementById("txtHint").innerHTML = "";
          return;
      } else { 
          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").innerHTML = xmlhttp.responseText;
              }
          }
          xmlhttp.open("GET","getuser.php?q="+str,true);
          xmlhttp.send();
      }
  }
  </code></pre>
  
  <p>but can't seem to work out how execute it for each row in the table.</p>
  
  <p>Any help is very much appreciated.</p>
  
  <p>So this is how I want it to work; I have a table of contacts displayed on a page and for each one displayed it will send and email and report back success, so basically onload of each row execute this. How can I achieve that? </p>