Autocomplete and Mapping XML data
I'm trying to follow JQuerUI's example wtih mapping XML from an AJAX Response to an autocomplete textbox.
I feel like im following the example, but not sure where im going wrong. here is my code:
- $.ajax({
- type: "POST",
- async: true,
- timeout: null,
- url: "ASNProxy.asmx/getStoresOnPO",
- dataType: "xml",
- data: { xmlDoc: criteria },
- success: function (xmlResponse) {
- var data = $("STORE", xmlResponse).map(function () {
- return {
- value: $("STORE_NAME", this).text(),
- id: $("STORE_NO", this).text()
- };
- }).get();
- $("#txtNewFromStoreNo").autocomplete({
- source: data
- });
- }
- });
- And Here is my XML: I've test the webservice, and the result in the debugger, so i know it's returning ok...i think.
- <?xml version="1.0" encoding="UTF-8"?>
- -<RESULT>
- -
- <RETURN>
- <CODE>0</CODE>
- <MESSAGE>6</MESSAGE>
- </RETURN>
- -<DATA>
- -
- <STORE_LIST>
- -<STORE>
- <STORE_NO>1101</STORE_NO>
- <STORE_NAME>VANCOUVER DOWNTOWN</STORE_NAME>
- </STORE>-<STORE>
- <STORE_NO>1125</STORE_NO>
- <STORE_NAME>SOUTHGATE</STORE_NAME>
- </STORE>
- -<STORE>
- <STORE_NO>1144</STORE_NO>
- <STORE_NAME>MARKET MALL</STORE_NAME>
- </STORE>
- -<STORE>
- <STORE_NO>1560</STORE_NO>
- <STORE_NAME>DOWNTOWN</STORE_NAME>
- </STORE>-<STORE>
- <STORE_NO>1601</STORE_NO>
- <STORE_NAME>MAIN</STORE_NAME>
- </STORE>-<STORE>
- <STORE_NO>1611</STORE_NO>
- <STORE_NAME>POINTE CLAIRE</STORE_NAME>
- </STORE>
- </STORE_LIST>
- </DATA>
- </RESULT>