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