Autocomplete Mapping JSON data
I have successfully mapped some XML data to my auto completes. I used XML because it is more familiar to me, but i think i should be using JSON to be consistent with the way my shop develops.
Here is my function using XML:
- function (xmlResponse, callback) {
- var data = $("STORE", xmlResponse).map(function () {
- return {
- label: $("STORE_NO", this).text() + " - " + $("STORE_NAME", this).text(),
- value: $("STORE_NO", this).text()
- };
- }).get();
If i changed my webservice to return JSON, how would i do the identical thing? I think understanding this one example, will help me understand it in general and be able to apply what i learn here to different cases.