Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jochemstoel/259502f5cd7849df3bd7deae2e5b63c6 to your computer and use it in GitHub Desktop.

Select an option

Save jochemstoel/259502f5cd7849df3bd7deae2e5b63c6 to your computer and use it in GitHub Desktop.
xhr ip
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