What is the status of using remote JSON with jquery.autocomplete? I
saw a couple of threads in the group about it, but they are patchworky
and hard to follow. I did not see anything about using JSON on the
autocomplete jquery plugin site. Is using remote JSON supported or do
I have to modify source to make it work?

Here is what I am trying to do. I created a WS to return some user
data for an autocomplete. Here is the JSON that is returned when I
type 'j' into my autocomplete form field.

{"linked-list":{"gov.nasa.hq.portal.calendar.to.PersonTO":
[{"personId__":
6,"firstName__":"Jack","lastName__":"Black","email__":"jbl...@jackblack.com"},
{"personId__":
1,"firstName__":"Joe","lastName__":"Blow","email__":"jb...@hotmail.com"},
{"personId__":
4,"firstName__":"Jason","lastName__":"Giambi","email__":"jgia...@yahoo.com"},
{"personId__":
3,"firstName__":"Jim","lastName__":"Jones","email__":"jjo...@hotmail.com"},
{"personId__":
5,"firstName__":"Jill","lastName__":"Robin","email__":"jro...@gmail.com"},
{"personId__":
2,"firstName__":"Jason","lastName__":"Smith","email__":"jsm...@hq.nasa.gov"}]}}

Here is my javascript:

document.observe("dom:loaded", function() {

        jQuery("#pocEmail").autocomplete("../screen/PersonLookup", {
            width: 260,
            minChars: 1,
            cacheLength: 20,
            selectFirst: false,
            max: 25,
            extraParams: {field2Use:'email',output:'json'},
            formatItem: function(row, i, max) {
                alert(row);
                return row;
                //return row.firstName__ + " " + row.lastName__ + "["
+ row.email + "]";
            }
        });
});

The entire JSON is getting returned as a row, so I assume it is being
treated as a String and is seen as one row.

Can I make this work without too much hardship? The WS I created can
return XML as well if that is an option.

Thanks!

Reply via email to