Take a look at the source of this demo:
http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/json.html

That should be very close to what you're looking for.

Jörn

On Thu, Dec 4, 2008 at 4:13 PM, monk.e.boy <[EMAIL PROTECTED]> wrote:
>
> My JS:
>
> var data = [ {text:'Link A', url:'/page1'}, {text:'Link B', url: '/
> page2'} ];
>
>        $().ready(function() {
>
>                $("#names_autocomplete")
>                        .autocomplete(data, {mustMatch: true, autoFill: true,
> matchContains: false})
>                        //.result(function(event, item) 
> {document.nav_admin.submit()});
>                        .result(function(event, item) { location.href = 
> item.url } );
>                        //.result(function(event, item) {alert
> ("!");document.nav_admin.submit()});
>                });
>
>
> ----------
>
> The error is: value is undefined, line 460
> When I use an array of strings it works fine, but I would like to use
> an array of names with the DB id of the name, when the user selects
> the name the ID is sent to the next page :-)  so my data would look
> like {text:'monk.e.boy', url:'?id=XXX'}
>
> That would be great :-)
>
> Even better would be for the autocomplete to auto load the next page,
> POSTing the ID... I'm not sure how I'd do that?
>
> Thanks
>
> monk.e.boy

Reply via email to