Code has been added to clipboard!

Web Application With PHP AJAX

Example
<html>
<head>
  <script>
    function showUser(str) {
      if (str == '') {
        document.getElementById("txt_hint").innerHTML = "";
        return;
      } else { 
        if (window.XMLHttpRequest) {
          // script for browser version above IE 7 and the other popular browsers (newer browsers)
          xmlhttp = new XMLHttpRequest();
        } else {
          // script for the IE 5 and 6 browsers (older versions)
          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
          if (this.readyState == 4 && this.status == 200) {
            // get the element in which we will use as a placeholder and space for table
            document.getElementById("txt_hint").innerHTML = this.responseText;
          }
        };
        xmlhttp.open("GET", "getuser.php?q="+str, true);
        xmlhttp.send();
      }
    }
  </script>
</head>
<body>
  <form>
    <select name="users" onchange="showUser(this.value)">
    <option value="">Select a person:</option>
    <option value="1">Mark Dooley</option>
    <option value="2">Lewis Kirkbride</option>
    <option value="3">Jack Lee</option>
    <option value="4">Mary Jefferson</option>
    </select>
  </form>
  <br>
  <div id="txt_hint"><b>This is where info about the person is displayed.</b></div>
</body>
</html>