Well, when using remote JSON, your server code has to do the
filtering. Your server returns all results, so the autocomplete
displays them all.

Here are several demos with local JSON, which may be closer to what
you are looking for. You can even get the JSON via Ajax, then use it
to initialize the autocomplete:
http://jquery.bassistance.de/autocomplete/demo/

Jörn

On Wed, Sep 3, 2008 at 4:17 PM, JD <[EMAIL PROTECTED]> wrote:
>
> Here is a test: http://aasenboligdesign.no/test/test.htm
>
> JD
>
> On 3 Sep, 15:43, "Jörn Zaefferer" <[EMAIL PROTECTED]>
> wrote:
>> Okay. Can you post a testpage?
>>
>> Jörn
>>
>> On Wed, Sep 3, 2008 at 1:13 PM, JD <[EMAIL PROTECTED]> wrote:
>>
>> > Hi again!
>>
>> > hehe, it was just a typo from me when I pasted the code... The above
>> > code should be correct.
>>
>> > Anyhow, I get all the data from JSON, but if I type "D", every single
>> > item from the file shows in the autocomplete-box.
>>
>> > Strange... But apart from this obvious error, it works great :-)
>>
>> > On 3 Sep, 12:59, "Jörn Zaefferer" <[EMAIL PROTECTED]>
>> > wrote:
>> >> Looks like a typo in your parse implementation:  value: row.aname,
>> >> should be  value: row.name,
>>
>> >> Jörn
>>
>> >> On Wed, Sep 3, 2008 at 8:32 AM, foxtrot <[EMAIL PROTECTED]> wrote:
>>
>> >> > Oops, sorry aboute the missing code....
>>
>> >> > $(document).ready(function(){
>> >> >        $("#client").autocomplete("data.json", {
>> >> >                parse: function(data) {
>> >> >                        return $.map(eval(data), function(row) {
>> >> >                                customers = data;
>> >> >                                return {
>> >> >                                        data: row,
>> >> >                                        value: row.aname,
>> >> >                                        result: row.name
>> >> >                                }
>> >> >                        });
>> >> >                },
>> >> >                minChars: 2,
>> >> >                width: 263,
>> >> >                formatItem: function(item){
>> >> >                        return item.name;
>> >> >                }
>> >> >        })
>> >> > });
>>
>> >> > the html is just a input-field, and the json have this structure:
>>
>> >> > {
>> >> >        customers:[
>> >> >                {
>> >> >                        "name": "A",
>> >> >                  "project":[
>> >> >                                {"name": "project1"},
>> >> >                                {"name": "project2"},
>> >> >                                {"name": "project3"}
>> >> >                        ]
>> >> >                },
>> >> >                {
>> >> >                        "name": "B",
>> >> >                  "project":[
>> >> >                                {"name": "project1"},
>> >> >                                {"name": "project2"},
>> >> >                                {"name": "project3"},
>> >> >                                {"name": "project4"},
>> >> >                                {"name": "project5"}
>> >> >                        ]
>> >> >                },
>> >> >                {
>> >> >                        "name": "C",
>> >> >                  "project":[
>> >> >                                {"name": "project1"},
>> >> >                                {"name": "project2"}
>> >> >                        ]
>> >> >                }
>> >> >        ]
>> >> > }
>>
>> >> > On 3 Sep, 00:44, MorningZ <[EMAIL PROTECTED]> wrote:
>> >> >> "What can cause this?"
>>
>> >> >> that would be your code...  but where and when and how is unknown with
>> >> >> what little you provide
>

Reply via email to