-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
32 lines (26 loc) · 903 Bytes
/
script.js
File metadata and controls
32 lines (26 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function ajax() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status==200) {
var response = JSON.parse(this.responseText);
var grolist=response.list;
var body = document.getElementById("tBody");
var trow="";
for (var i = 0; i < grolist.length; i++) {
var trow = `<tr>
<th scope="row">${grolist[i].sNo}</th>
<td>${grolist[i].iNam}</td>
<td>${grolist[i].qnty}</td>
<td>${grolist[i].unit}</td>
<td>${grolist[i].dept}</td>
<td>${grolist[i].note}</td>
<td><input class="check" type="checkbox"></td>
</tr>`;
body.innerHTML += trow;
}
}
};
xhttp.open("GET", "./list.json", true);
xhttp.send();
}
window.addEventListener("load", ajax);