What I want to do is to be able to load data from the database which will show up as an auto-complete text below the textbox. I'm using the ajax function in jquery to load data from the database. My problem now is how to put that data in the auto-suggest box.
<html>
<head>
<script src="js/jq.js"></script>
<link rel="stylesheet" href="css/otocomplete.css" type="text/css" />
<link rel="stylesheet" href="css/otocomplete.css" type="text/css" />
<script type="text/javascript" src="js/bigiframe.js"></script>
<script type="text/javascript" src="js/otocomplete.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#example').keyup(function(){
var inpval = $('#example').val();
$.ajax({
type: 'POST',
data: ({p : inpval}),
url: 'query.php',
success: function(data) {
$("#yoh").autocomplete(data);
}
});
});
});
</script>
</head>
<body>
text: <input id="example" />
<div id="yoh"></div>
</body>
</html>