Welcome aboard! We are happy you are here and wish you good net-raft!
// put into html document
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script type="text/typescript" src="TypeScript.ts"></script>
<script type="text/typescript">
console.log('city');
</script>
<script src="https://rawgit.com/Microsoft/TypeScript/master/lib/typescriptServices.js"></script>
<script src="https://rawgit.com/basarat/typescript-script/master/transpiler.js"></script>
</head>
<body>
</body>
</html>
// put into TypeScript.ts
function foo(data) {
var city = data.city
document.body.innerHTML = `<div>${city}</div>`
}
var userip;
var script = document.createElement('script');
script.src = "https://geoip.nekudo.com/api?callback=foo";
script.onload = function () {myFunction()};
document.head.appendChild(script);
<!DOCTYPE html>
<html>
<head>
<script type="text/typescript" src="TypeScript.ts"></script>
<script type="text/typescript">
console.log('ip');
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://rawgit.com/Microsoft/TypeScript/master/lib/typescriptServices.js"></script>
<script src="https://rawgit.com/basarat/typescript-script/master/transpiler.js"></script>
</head>
<body>
</body>
</html>
// put into TypeScript.ts
$.get("https://geoip-db.com/json/geoip.php?jsonp=?", function(response) {
var ip:string = response.city
document.body.innerHTML = `<div>${ip}</div>`
}, "jsonp");
The most helpful TYPESCRIPT solutions
get client ip address using typescriptTYPESCRIPT Click to see more ... 6.3K 243