Skip to content

Instantly share code, notes, and snippets.

@isitavi
Created December 6, 2018 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isitavi/bf7277b1fd580c7963ba5d03bd35b723 to your computer and use it in GitHub Desktop.
Save isitavi/bf7277b1fd580c7963ba5d03bd35b723 to your computer and use it in GitHub Desktop.
IP-Problem1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>Document</title>
</head>
<body>
<h3>Insert IP and get your all location</h3>
<button id="btn">GetInfo</button>
<script src="index.js"></script>
</body>
</html>
let firstURL = "http://ip-api.com/json/63.70.164.200"
let secondURL = "http://ip-api.com/json/168.12.13.1"
$("#btn").click(function () {
$.when(
$.getJSON(firstURL),
$.getJSON(secondURL)
).done(function (jsonResult1, jsonResult2) {
console.log(`${jsonResult1[0].city},${jsonResult1[0].regionName},${jsonResult1[0].country}`);
console.log(`${jsonResult2[0].city},${jsonResult2[0].regionName},${jsonResult2[0].country}`);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment