0
我是Jquery Mobile的新手。我試圖從Web服務結果中加載一個列表,下面是我直接調用Web服務時的代碼可以看到輸出但不能從Jquery移動端查看從WCF到列表的Jquery Mobile數據
以下是我的Jquery移動代碼和Web服務輸出。任何幫助對我來說都很棒。
var serviceURL = "http://localhost:8008/Service1/";
var employees;
$('#employeeListPage').bind('pageinit', function(event)
{
getEmployeeList();
});
function getEmployeeList()
{
$.getJSON(serviceURL, function (data)
{
alert("asda")
$('#employeeList li').remove();
employees = data.items;
$.each(employees, function(index, employee)
{
$('#employeeList').append('<li>Vishnu.....</li>');
});
$('#employeeList').listview('refresh');
});
}
<div data-role="content">
<ul id="employeeList" data-role="listview" data-filter="true"></ul>
</div>
Web服務輸出
<ArrayOfSampleItem xmlns="http://schemas.datacontract.org/2004/07/RestWServices"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<SampleItem><Id>0</Id><StringValue>ItemName 0</StringValue></SampleItem>
<SampleItem><Id>1</Id><StringValue>ItemName 1</StringValue></SampleItem>
<SampleItem><Id>2</Id><StringValue>ItemName 2</StringValue></SampleItem>
<SampleItem><Id>3</Id><StringValue>ItemName 3</StringValue></SampleItem>
<SampleItem><Id>4</Id><StringValue>ItemName 4</StringValue></SampleItem>
<SampleItem><Id>5</Id><StringValue>ItemName 5</StringValue></SampleItem>
<SampleItem><Id>6</Id><StringValue>ItemName 6</StringValue></SampleItem>
<SampleItem><Id>7</Id><StringValue>ItemName 7</StringValue></SampleItem>
<SampleItem><Id>8</Id><StringValue>ItemName 8</StringValue></SampleItem>
<SampleItem><Id>9</Id><StringValue>ItemName 9</StringValue></SampleItem>
</ArrayOfSampleItem>