我想在 android phonegap 的 listview 中显示来自 servlet 的 json 数据。但它在android模拟器中显示空白页。它也没有调用 servlet。这是我的代码,请帮助我。
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=320; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Auth Demo</title>
<link rel="stylesheet" href="jquery.mobile-1.3.2.css" type="text/css" charset="utf-8" />
<script type="text/javascript" src="jquery.mobile-1.3.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script src="jquery-1.9.1.js"></script>
<script src="jquery.mobile-1.3.2.js"></script>
<script>
$.ajax({
url: 'http://10.0.2.2:7080/example/CaseList',
dataType: 'jsonp',
jsonp: 'jsoncallback',
timeout: 5000,
success: function(data, status){
$.each(data, function(i, item) {
$('ul').append('<li><a href="">' + item.case + '</a></li>');
});
$('#output').listview("refresh");
},
error: function(){
output.text('There was an error loading the data.');
}
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="content">
<ul data-role="listview" data-filter="false" id="output" data-theme="d">
</ul>
</div>
</div>
</body>
</html>