0
這是從一個web服務返回的XML列表:引導3預輸入從返回的web服務列表
public async Task<SelectResponse> AutoSearchService(string filter)
{
SelectResponse ResponseData = new SelectResponse();
var Url = string.Format("{0}{1}", "serviceURL", filter);
var Client = new HttpClient();
Client.BaseAddress = new Uri(Url.ToString());
Client.DefaultRequestHeaders.Accept.Clear();
Client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/xml"));
var ResponseMessage = await Client.GetAsync(Url.ToString());
if (ResponseMessage.IsSuccessStatusCode)
{
//Get Tickets from Banner
ResponseData = ResponseMessage.Content.ReadAsAsync<SelectResponse>().Result;
}
return ResponseData;
}
,並獲得類似這樣的XML數據:
<SelectResponse>
<SelectResult>
<STVSBGIRECORDSELECT>
<STVSBGI_DESC>Holback Handelsskole</STVSBGI_DESC>
</STVSBGIRECORDSELECT>
<STVSBGIRECORDSELECT>
<STVSBGI_DESC>Los Gatos High Sch.-Los Gatos</STVSBGI_DESC>
</STVSBGIRECORDSELECT>
<STVSBGIRECORDSELECT>
<STVSBGI_DESC>Rich East High Sch.</STVSBGI_DESC>
</STVSBGIRECORDSELECT>
</SelectResult>
</SelectResponse>
然後我需要將它添加到以下jQuery代碼中的查詢列表中,而不是本地值:
$('#query').typeahead({
local: ['alpha', 'allpha2', 'alpha3', 'bravo', 'charlie', 'delta', 'epsilon', 'gamma', 'zulu']
});
我應該怎麼辦?