Kasutliidesed lab 2 otsingu html

Allikas: Lambda
<html>
<head>
<script>
var request;
var url;
var response;
var eresp;

function myupdatefun() {
  //alert(request.readyState)
  if (request.readyState == 4) {   
       //alert("Server is done!"); 
       if (request.status == 200) {
          //alert("Server sent data ok!");       
          response = request.responseText
          //alert(response)
          eresp=eval(response)
          compres="<table>\n"
          for (i=0; i<eresp.length; i++) {
            //alert(eresp[i])
            compres=compres+"<tr>\n"
            for (j=0; j<(eresp[i]).length; j++) {
              //alert(eresp[i][j])
              compres=compres+"<td>"+eresp[i][j]+"</td>"
            }
            compres=compres+"</tr>\n"
          }
          compres=compres+"</table>"
          //alert(compres);
          document.getElementById('sisu2').innerHTML=compres;
       } else if (request.status == 404)
         alert("Request URL does not exist");
       else
         alert("Error: status code is " + request.status);   
  }       
         
}  

function ajaxcall() {
  request = new XMLHttpRequest();
  //url = "http://www.mysite.com"
 //url = "http://www.mysite.com"
  url = "http://193.40.254.12/cgi-bin/tammet/otsi.py?laadija="
  url=url+document.getElementById('laadija').value
  request.open("GET", url, true);
  request.onreadystatechange = myupdatefun;
  request.send(null);
}  


</script>
<body>
Tere kah!

Otsivorm:
<form>
laadija: <input type="text" name="laadija" id="laadija"></input>
<input type="button" value="otsi!" onclick="ajaxcall()">
</form>

<div id="sisu2"></div>
</body>