Undefined Results in jQuery Autocomplete
Posted
by CreativeNotice
on Stack Overflow
See other posts from Stack Overflow
or by CreativeNotice
Published on 2010-04-26T13:11:13Z
Indexed on
2010/04/26
13:13 UTC
Read the original article
Hit count: 507
So I've got the latest versions of jQuery and UI running. I'm using the basic autocomplete invocation and returning valid JSON (validated via JSONLint).
$("input#cust_id").autocomplete({
source: yoda.app.base + "/assets/cfc/util/autocomplete.cfc?method=cust",
minLength: 2,
select: function(event, ui) {
log(ui.item ? ("Selected: " + ui.item.value + " aka " + ui.item.id) : "Nothing selected, input was " + this.value);
}
});
Both the value and label elements of the returned array show up in the list as undefined. I can watch the results returned via Firebug and the JSON is correct there as well. Also, while the list only says "undefined" it does say that the same number of times as records returned in JSON.
[{"VALUE":"custid1","LABEL":"My Customer Name 1"},{"VALUE":"custname2","LABEL":"My customer name 2"}]
© Stack Overflow or respective owner