Add Tablefill
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
<body>
|
||||
<div class="playerlist">
|
||||
<div id="testDiv"></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -21,11 +22,19 @@
|
||||
<th><center>Ping</center></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tr class="playerAmount"></tr>
|
||||
<tbody id="playerData"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script src="jquery-3.3.1.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
//var table;
|
||||
for (var player in pList) {
|
||||
$("#playerData").append("<tr><td>" + player.Id + "</td><td>" + player.Name + "</td><td>" + player.Ping + "</td></tr>");
|
||||
//table =+ tableRow;
|
||||
}
|
||||
//document.getElementById("testDiv").innerHTML = table;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,8 +16,19 @@ mp.events.add("showPlayerlist", () => {
|
||||
});
|
||||
|
||||
mp.events.add("fetchPlayerList", (playersJson) => {
|
||||
var players = JSON.parse(playersJson);
|
||||
players.forEach((player) => {
|
||||
|
||||
pList = JSON.parse(playersJson);
|
||||
|
||||
pList.forEach((player) => {
|
||||
mp.gui.chat.push(player.Id + ", " + player.Name + ", " + player.Ping);
|
||||
});
|
||||
});
|
||||
|
||||
//function getTable() {
|
||||
// var table = "";
|
||||
// pList.forEach((player) => {
|
||||
// var tableRow = "<tr><td>" + player.Id + "</td><td>" + player.Name + "</td><td>" + player.Ping + "</td>";
|
||||
// table = table + tableRow;
|
||||
// })
|
||||
// return document.write(table);
|
||||
//}
|
||||
Reference in New Issue
Block a user