我是phonegap的新手,我想将数据从sevlet加载到android中的listview。 sevlet称它无法将数据加载到listview中。并且从ajax调用中调用alert messege。始终显示加载数据时出错。我的代码请帮帮我。
<!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>
</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>
<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(){
alert("There was an error loading the data.");
}
});
</script>