The data returned is an array of objects. The value
parameter of your $.map()
call contains the object, and the key
parameter is the index of the item in the array (See the first "overload" here). So you are setting the object itself as the label
property, which is why it's being displayed as [object Object]
.
Try this:
response($.map(data, function (item, idx) {
return {
label: item.Value,
value: item.Key
};
}));