This seems, to me, like an awfully inefficient technique/solution. For
one thing, the most used "autocomplete" functionality is concerned
with trying to guess search terms or even results based on an
incomplete search term. This means performing searches incrementally
as the user types his search terms. What you're describing seems kind
of more like apple.com's search function, where important keywords are
matched to sections of the website. For this behaviour all you need is
a hash/map over common search terms and URLs they apply to. You're
example shows a simple array where a object literal seems more
appropriate. Consider this:
var terms = {
    "ATS": "atshome.htm",
    "UPS": "upshome.htm",
    "UPS 5-10 kVA": "5-10kVA.htm"
};

With this you could simply iterate over the object properties and
match against the search term (crude example):
for (var key in terms) {
    if (key.match(search)) {
        window.location = terms[key];
    }
}

--
Frode Danielsen

On Oct 9, 10:15 pm, ravi <pprya...@gmail.com> wrote:
> Hi,
>
> I am trying to implement a search functionality which kind of
> combining few features. What I really want is a google type search
> input text with dropdown list with autocomplete functionality. The
> dropdown list should show all the items on the list at the same time
> the user should be able to type to get to an item. Once the item is
> selected, the user should redirected to the page that is associated
> with the item.
>
> I tried this using array to build up all the items that will show up
> on the list with jquery autocomplete, but not sure how to wireup the
> html pages that is associated with the selection. This is just few
> items that show in here, the list might have about 100 items.
>
> function(){
>         var autoFill=new Array();
>         autoFill[0]="ATS"          //when this selected, it should redirected
> to atshome.htm
>         autoFill[1]="UPS"         //when this selected, it should redirected
> to upshome.htm
>         autoFill[2]="UPS 5-10 kVA"   //should reidrected to 5-10kVA.htm
>         autoFill[3]="IT Series"          // should reidrected to itseries.htm
>         autoFill[4]="ML Series"        // should reidrected to mlseries.htm
>         autoFill[5]="LP Series"        //
>         autoFill[6]="VH Series"       //
>         autoFill[7]="GT Series"       //
>
> $("#example").autocomplete(autoFill);
>    });
>
> Search: <input id="example" >
>
> Any help or suggestion would be really appreciated.
>
> Thanks,
> Ravi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to