Zoeken in database met Aj*x en toetsaanslag

Dit bestand maakt gebruik van livesearch.php Livesearch.php (zoekpagina)
Student.sql database
Typ een letter om de records in de database te lezen.
<html>
<body>
<h1>Zoeken in database met Aj*x en toetsaanslag</h1>
Dit bestand maakt gebruik van livesearch.php
<a href="livesearch.php">Livesearch.php (zoekpagina)</a></br>
<a href="student.sql">Student.sql database</a>
<script type="text/javascript">
<!-- Javascript functie !-->
<!-- Voorbeeld van https://www.w3schools.com/php/php_ajax_livesearch.asp !-->
function ZoekFunctie(str)
{
var httpxml;
try
  {
  // Firefox, Opera 8.0+, Safari
  httpxml=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    httpxml=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      httpxml=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
function stateChanged() 
    {
    if(httpxml.readyState==4)
      {
document.getElementById("DataDiv").innerHTML=httpxml.responseText;
document.getElementById("msg").style.display='none';

      }
    }
    /* php bestand importeren*/
    var url="livesearch.php";
url=url+"?txt="+str;
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=stateChanged;
httpxml.open("GET",url,true);
httpxml.send(null);
document.getElementById("msg").innerHTML="Please Wait ...";
document.getElementById("msg").style.display='inline';

  }
</script>
</head>
<body>

<form name="form">
<input type="text" onkeyup="ZoekFunctie(this.value);" name="naam" autocomplete="off" />
Typ een letter om de records in de database te lezen.
<div id="DataDiv"></div>
</form>

</body>
</html>
<?
show_source
(__FILE__);
?>