-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
20 lines (16 loc) · 1020 Bytes
/
script.js
File metadata and controls
20 lines (16 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
document.getElementById('outputButton').onclick = function() {
fetch("https://api.mcsrvstat.us/3/" + document.getElementById('search').value)
.then(response => response.json())
.then(data => {
console.log(data)
document.getElementById('output_icon').src = data.icon
document.getElementById('output_hostname').innerHTML = "Hostname: " + data.hostname;
document.getElementById('output_online').innerHTML = "Online: " + data.online;
document.getElementById('output_ip').innerHTML = "IP: " + data.ip;
document.getElementById('output_port').innerHTML = "Port: " + data.port;
document.getElementById('output_players_max').innerHTML = "Server size: " + data.players.max;
document.getElementById('output_players_online').innerHTML = "Players online: " + data.players.online;
document.getElementById('output_motd').innerHTML = data.motd.html;
})
.catch(error => console.log(error));
};