Forked from pganti/gist:3e6fe786e345628e542d351bbd91ff29
Created
February 22, 2021 11:40
-
-
Save jochemstoel/259502f5cd7849df3bd7deae2e5b63c6 to your computer and use it in GitHub Desktop.
xhr ip
This file contains hidden or 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
| var xhttp = new XMLHttpRequest(); | |
| xhttp.onreadystatechange = function() { | |
| if (xhttp.readyState == 4 && xhttp.status == 200) { | |
| console.log(JSON.parse(xhttp.responseText).ip); | |
| } | |
| }; | |
| xhttp.open("GET", "https://api.ipify.org?format=json", true); | |
| xhttp.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment