Created
December 6, 2018 05:22
-
-
Save isitavi/bf7277b1fd580c7963ba5d03bd35b723 to your computer and use it in GitHub Desktop.
IP-Problem1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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