getJSON('http://localhost:63322/logs',
function(err, data) {
if (err !== null) {
alert('Something went wrong: ' + err);
} else {
//var myObj = JSON.parse(data);
// document.getElementById("demo").innerHTML = myObj.ad_soyad;
items_table = document.getElementById('items_table');
for(var ctr = 0; ctr < data.length; ctr++)
{
items_table.innerHTML+= '<tr><td>' + data.data[ctr].uid + '</td><td>' +data.data[ctr].ad_soyad + '</td></tr>';
}
}
<form id="form">
<table id='items_table' border=1>
<tr><th colspan='2'>liste</th></tr>
<tr><th>uid</th><th>ad_soyad</th></tr>
</table>
在这些代码中,我无法显示表格。我的 json 对象没有问题。我可以显示 json 对象,但无法在表格中显示此对象。如何解决此问题?
我的 json 对象是
{"数据":[{"uid":2,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":" gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg" },{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"}, {"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{" uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":6,"ad_soyad":"gg"},{"uid":6,"ad_soyad":"gg"},{" uid":10,"ad_soyad":"gg"},{"uid":16,"ad_soyad":"gg"},{"uid":190,"ad_soyad":"gg"},{"uid" :200,"ad_soyad":"gg"},{"uid":200,"ad_soyad":"gg"},{"uid":220,"ad_soyad":"gg"},{"uid":4 ,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4," ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"},{"uid":4,"ad_soyad":"gg"}]}
谢谢你的帮助....
汪汪一只猫
相关分类