Created
December 17, 2018 09:59
-
-
Save bhandarisaurav/83ccd91f1401cc1734077e40d3f9a3d7 to your computer and use it in GitHub Desktop.
Get System's Public IP Address
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
$(document).ready(function () { | |
var xmlhttp = new XMLHttpRequest(); | |
var url = "http://ipecho.net/plain"; | |
xmlhttp.onreadystatechange = function () { | |
if (this.readyState == 4 && this.status == 200) { | |
IP = this.responseText; | |
// IP variable stores the PUBLIC IP address of the system | |
//for eg 110.44.116.42 | |
} | |
}; | |
xmlhttp.open("GET", url, true); | |
xmlhttp.send(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment