What to do with jQueryUI autocomplete?

Hi all,

I have “successfully implemented” a number of jqueryui widgets/plugins but am at a loss as to what to do with the autocomplete plugin. Do you integrate the plugin with a website search engine or what?

I’ve seen an autocomplete plugin that includes links to other pages in the results. So if I select “Berlin” in will automatically load the “Berlin” page.

How would I go about doing this? Please advise me.

Thank you!!!

Hi,

From the Autocomplete | jQuery homepage:

The datasource is a simple JavaScript array, provided to the widget using the source-option.

This means that in its simplest form, you point the plugin at an array like this:

var availableTags = [
      "ActionScript",
      "AppleScript",
      "Asp",
      "BASIC",
      "C",
      "C++",
      "Clojure",
      "COBOL",
      "ColdFusion",
      "Erlang",
      "Fortran",
      "Groovy",
      "Haskell",
      "Java",
      "JavaScript",
      "Lisp",
      "Perl",
      "PHP",
      "Python",
      "Ruby",
      "Scala",
      "Scheme"
    ];

and it will filter the results depending on what is typed.

You might notice however, that there is a remote option, in which case the datasource is a server-side script which returns JSON data, specified via a simple URL for the source-option.

To make your page load a new page based on the user’s input shouldn’t be too hard.
You would probably have to hook into the select event, which is triggered when an item is selected from the menu.

If you have any questions about the implementation, just let me know.

Hi Pullo,

thank you for taking the time to clarify this. I’m relatively new to JavaScript and jQuery, so when I tried the autocomplete widget a few months back it didn’t work. Perhaps this time around…

Thanks again!