Based on http://plugins.jquery.com/project/autocompletex

$("#search").autocomplete("/searchAutocomplete", {
        dataType: "json",
        parse: function(data) {
                return $.map(data, function(row) {
                        return {
                                data: row,
                                value: row.text
                        }
                });
        },
        formatItem: function(item) {
                return item.text;
        },
        minChars: 1,
        selectFirst: false
}).result(function(event, data) {
        location.href = data.url;
});

The JSON response looks like this:

[{"text":"google","url":"http://google.com"}, {"text": "other", "url":
"whatever"}]

Jörn

On Tue, Sep 1, 2009 at 11:57 PM, ladksak<slingrs...@gmail.com> wrote:
>
> Hello
>
> I'm looking for an autocomplete that have no "submit" button, but that
> when the user click on the autocomplete keyword he would be redirected
> to another URL, that i will choose
>
> i'm using http://dyve.net/jquery/?autocomplete but even the author
> dont know how to make this
>
> example:
>
> user type "goo"
> then appears GOOGLE for him, when he click on GOOGLE the script send
> him to www.google.com
>
> it would be great if i could just do with the script i told you guys
> i'm not a programmer so i need like, the code itself, i know its too
> much to ask but i tried everything =\
>
> thank you!
>

Reply via email to