Ok, that's a great article but not exactly what I need. I don't need
to modify the results of the select (yet) but I need to modify the
output of the results: a mulit-dimensional array that would need to be
looped and shown. It might require a whole script entirely, but
there's just too much good stuff in Jorn's plugin that I could never
do on my own.



On Jun 17, 2:59 pm, Shawn <[EMAIL PROTECTED]> wrote:
> Which autocomplete are you using?  Which version?
>
> Not meaning to do a shameless plug, but I wrote a blog article that
> covered using database IDs with Jorn's autocomplete.
>
> http://grover.open2space.com/node/190
>
> This was back in December, so might be a little dated.  But I believe
> what you are trying to do seems relatively similar.  Perhaps that might
> help?
>
> Shawn
>
> Adam wrote:
> > Tried to post this question once before but didn't seem to work...
>
> > I'm needing to get a multi-dim JSON array to work for my autocomplete,
> > in an effort to mimic the Spotlight design.
>
> > My JSON currently looks like this:
>
> > [
> > {"key":"names", "values":[ bunch of values]},
> > {"key":"emails","values": [ bunch of email values ]}
> > ]
>
> > I am wanting to put into an HTML structure like this:
>
> > <dl>
> > <dt>Names</dt>
> > <dd><a href="#">name</dd>
> > <dd><a href="#">name</dd>
>
> > <dt>Emails</dt>
> > <dd><a href="#">email</dd>
> > <dd><a href="#">email</dd>
> > </dl>
>
> > Basically, I want my JS to loop through the JSON array and spit out
> > the key into a <dt> tag, then each item into a <dd>. Easier said than
> > done.
>
> > Can anyone give me some direction? I've got it as far as listing all
> > the names and emails in <dd>'s, but no <dt>'s are happening...
>
> > Here is my adapted autocomplete.js code:
>
> >    function parse(data) {
> >            var parsed = [];
> >            $(data).each( function() {
> >                    var rows = this.values;
> >                    for (var i=0; i < rows.length; i++) {
> >                            var row = rows[i];
> >                            if (row) {
> >                                    row = row.split("|");
> >                                    parsed[parsed.length] = {
> >                                            data: row,
> >                                            value: row[0],
> >                                            result: options.formatResult && 
> > options.formatResult(row,
> > row[0]) || row[0]
> >                                    };
> >                            }
> >                    }
> >            });
> >            return parsed;
> >    };
>
> > Thanks.

Reply via email to