how to use jquery auto-complete to load from mysql database
<p>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.</p>

<pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;script src="js/jq.js"&gt;&lt;/script&gt;
    &lt;link rel="stylesheet" href="css/otocomplete.css" type="text/css" /&gt;
    &lt;link rel="stylesheet" href="css/otocomplete.css" type="text/css" /&gt;
    &lt;script type="text/javascript" src="js/bigiframe.js"&gt;&lt;/script&gt;              
    &lt;script type="text/javascript" src="js/otocomplete.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
      $(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);
                }
            });
         });    
      });
    &lt;/script&gt;          
  &lt;/head&gt;
  &lt;body&gt;
     text: &lt;input id="example" /&gt;               
     &lt;div id="yoh"&gt;&lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>
