下面是我用来在phonegap中显示json数据但无法在html表中获取json数据的代码.......
$(document).ready(function() {
alert("load");
var data=[{
"firstcolumn":"56036",
"loc":"Deli",
"lastA":"Activity",
"mTime":"2011-02-01 11:59:26.243",
"nTime":"2011-02-01 10:57:02.0",
"Time":"2011-02-01 10:57:02.0",
"Age":"9867 Hour(s)",
"ction":" ",
"nTime":null
},
{
"firstcolumn":"56036",
"loc":"Deli",
"lastA":"Activity",
"mTime":"2011-02-01 11:59:26.243",
"nTime":"2011-02-01 10:57:02.0",
"Time":"2011-02-01 10:57:02.0",
"Age":"9867 Hour(s)",
"ction":" ",
"nTime":null
}];
$.each(data, function(key, val) {
var tr=$('<tr></tr>');
$.each(val, function(k, v){
$('<td>'+v+'</td>').appendTo(tr);
});
tr.appendTo('#display');
});
document.addEventListener("deviceready", onDeviceReady, true);
});
function onDeviceReady(){
navigator.notification.alert("PhoneGap is working");
}
</script>
</head>
<body>
<table border='1' id="display"></table>
</body>
</html>
尝试在id显示的表格中显示json数据.....如果要更改某些内容或在phonegap中进行任何设置,请告诉我