I have the following string representation of an actual JSON object returned from my service:
[
{
"label": "#1 Pizza [99999]",
"value": "99999"
},
{
"label": "001 Test Facility [99998]",
"value": "99998"
}
]
I am trying to put this in a jQuery autocomplete. But I don't have a clear idea why I don't see the data in that control.
I have looked all over for this and asked other questions. I have been working on this for DAYS and I am SO close so please help....
Here is my markup/script
<script type="text/javascript">
function processFacilities(data) {
response($.map(data, function (value, key) {
alert(data);
return {
label: value,
value: key
};
}));
};
$('#tags').autocomplete({
source: function (request, response) {
$.getJSON('FacilitiesAsync', 'sourceDb=myDb', processFacilities);
},
minLength: 2,
delay: 100
});
</script>
My class is returning the label and value as I saw was needed from the post below. What is different here is that my JSON data does not have something in front of it to identify it, for example: ["facilities": {etc...}]