慕尼黑3864816
<script type="text/javascript">
function getData(){
$.ajax({
type: "get",
url: "json/data.json",
data: {
},
success: function( result ) {
var asd=result.data;
var len=asd.length;
console.log(len);
if(len > 0){
for(var i=0; i<len; i++) {
console.log(asd[i]);
var len2 = asd[i].products.length;
var prd=asd[i].products;
console.log(len2);
if (len2 == 0) {
} else {
for (var j = 0; len2 > j; j++) {
console.log(prd[j]);
var tr = document.createElement('tr');
var thid = document.createElement('th');
$(thid).attr("rowspan", len2);
var tdname = document.createElement('td');
$(tdname).attr("rowspan", len2);
var tdurl = document.createElement('td');
var a=document.createElement('a');
var tdbackUrl = document.createElement('td');
var tdserverName = document.createElement('td');
var tddesc = document.createElement('td');
var tdusername = document.createElement('td');
var tdpassword = document.createElement('td');
thid.innerHTML = asd[i].id;
tdname.innerHTML = asd[i].name;
a.innerHTML=prd[j].url;
tdserverName.innerHTML = prd[j].serverName;
//tdurl.innerHTML = prd[j].url;
tdbackUrl.innerHTML = prd[j].backUrl;
tddesc.innerHTML = prd[j].desc;
tdusername.innerHTML = prd[j].username;
tdpassword.innerHTML = prd[j].password;
if (j == 0) {
tr.appendChild(thid);
}
if (j == 0) {
tr.appendChild(tdname);
}
tdurl.appendChild(a);
tr.appendChild(tdserverName);
tr.appendChild(tdurl);
tr.appendChild(tdbackUrl);
tr.appendChild(tddesc);
tr.appendChild(tdusername);
tr.appendChild(tdpassword);
var tbody = document.getElementById('tbody');
tbody.appendChild(tr);
}
}
}
}
}
})
};
</script>