I've been working on a site that currently uses Prototype+Scriptaculous's Ajax.Autocomplete. It works great at the moment, but I need to convert it to jQuery.
I know that jQueryUI has an Autocomplete, but I can't see if there's a way to use the existing external URL without needing to change it.
With Scriptaculous's Ajax.Autocomplete it's extremely simple:
new Ajax.Autocompleter('inputID', 'destinationID', 'search.php', {
paramName: 'q',
minChars: 2,
frequency: 0.4,
indicator: 'loading'
});
It's almost self-explanatory: inputID is the ID of the <input>, destinationID is the element you want the results to be displayed in. search.php is the page that returns the results from your database -- including the HTML you want displayed in the list.
The rest of the options should be pretty obvious :)
search.php?q=search-query current returns nicely formatted HTML like this:
<ul>
<li id="ID">Result</li>
<li id="ID">Result</li>
<li id="ID">Result</li>
</ul>
It would be great if I could just use this with the jQueryUI Autocomplete, but I don't know if it's possible (and if it is, how to do it).
I've looked through a bunch of tutorials on using jQueryUI's Autocomplete, but they all seem to focus on either either using a Javascript array (useless to me, since I have thousands of records to search through in a database), or JSON (which I'm hoping to avoid if possible).
Can it be done?