-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
46 lines (39 loc) · 1.04 KB
/
main.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function search(){
var ip=document.getElementById('ipval').value
var res = document.getElementById('ipres')
fetch(`https://geo.ipify.org/api/v2/country?apiKey=at_OFnlCij4ZAGvVzhljsQb1PJ63BZ0v&ipAddress=${ip}`)
.then(response => response.json())
.then(data => {
const {country,ip,location,as,region,timezone,name,isp} = data;
const output = `
<br>
<label>IP</label>
<br>
<span>${ip}</span>
<br>
<br>
<label>Localização</label>
<br>
<span>${location.region},${location.country}</span>
<br>
<br>
<label>Fuso Horario</label>
<br>
<span>${location.timezone}</span>
<br>
<br>
<label>Provedor</label>
<br>
<span>${isp}</span>
<br>
<br>
<label>Nome</label>
<br>
<span>${as.name}</span>
<br>
<br>
`
res.style.opacity='1'
res.innerHTML=output
})
}