32 lines
552 B
JavaScript
32 lines
552 B
JavaScript
// dip service
|
|
|
|
function main() {
|
|
var jqxhr =
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "https://ip.paulbsd.com",
|
|
headers: {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Accept': 'application/json',
|
|
},
|
|
dataType: 'json',
|
|
}).done(function(data) {
|
|
var dip = $('#dip');
|
|
dip[0].text = data.ip;
|
|
});
|
|
return jqxhr;
|
|
}
|
|
|
|
function transformIPInfo(data) {
|
|
if (data.hostname != '') {
|
|
return data.ip + '/' + data.hostname;
|
|
}
|
|
else {
|
|
return data.ip;
|
|
}
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
main();
|
|
});
|