<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax Sample</title>
<script type="text/javascript" src="../js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#filter").keyup(function(event){
$.ajax({
type: "GET",
url: "filter.lc",
data: "search_term="+$("#filter").attr("value"),
success: function(data){
$('#results').html(data);
}
});
});
});
</script>
</head>
<body>
Name: <input name="name" type="text" id="filter" />
<h2>Dynamic Resul</h2>
<div id="results">
<?lc

put revOpenDatabase("mysql","localhost","samples_people","samples_samples","samples09") into tConID

# Construct SQL
put "SELECT * FROM people" into tSQL

if tConID is a number then
# Execute SQL
put revDataFromQuery(tab, return, tConID, tSQL) into tList

set the itemdel to tab
put "<table cellpadding='3' width='360'>"
put "<tr><td width='20px'>ID</td><td width='120px'>Name</td><td width='35px'>Age</td><td>Email</td></tr>"
put "<tr><td></td><td></td><td></td><td></td></tr>"
repeat for each line tLine in tList
put item 1 of tLine into tID
put item 2 of tLine into tName
put item 3 of tLine into tAge
put item 4 of tLine into tEmail

put "<tr><td>" & tID & "</td><td>" & tName & "</td><td>" & tAge & "</td><td>" & tEmail & "</td></tr>"
end repeat
put "</table>"

revCloseDatase tConID
end if
?>
</div>
</body>
</html>