下面是我的代码,数据没有绑定到列表视图。显示一个空白页面。
<div data-role="page" id="index">
<div data-role="header">
<h1>
demo</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-inset="true" id="cars-data">
<li >abcd</li>
<li>cdf</li>
</ul>
</div>
</div>
<div data-role="page" id="cars">
<div data-role="header">
<a data-role="button" data-transition="none" data-theme="a" href="#index">Back</a>
<h1>
</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-inset="true" id="car-data">
</ul>
<img src="" width="100%" style="height: auto;" id="car-img">
</div>
</div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$.ajax({
type: "POST",
async: true,
url: "PINCWebService.asmx/GetContacts",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
// $("#car-data").html(data);
var list = $("#car-data");
list.empty();
$.each(data, function (rowIndex) {
var datar = data.rows.item(rowIndex);
list.append("<li>" + datar + "</li>");
});
list.listview('refresh');
}
});
});
</script>