updated main.js
This commit is contained in:
parent
01c49de4fc
commit
bfedf05f7d
@ -3,14 +3,24 @@
|
|||||||
function main() {
|
function main() {
|
||||||
var jqxhr =
|
var jqxhr =
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
url: "https://ip.paulbsd.com",
|
url: "https://ip.paulbsd.com",
|
||||||
headers: {
|
headers: {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
}).done(function(){ console.log(data.ip) });
|
}).done(function(data){ console.log(transformIPInfo(data)) });
|
||||||
return jqxhr;
|
return jqxhr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformIPInfo(data) {
|
||||||
|
if (data.hostname != '') {
|
||||||
|
return data.ip + '/' + data.hostname;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return data.ip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user