标签:pen proc highlight class == new 请求 html parse
<html>
<script>
var xhr = new XMLHttpRequest();
xhr.open(‘GET‘, "http://ipinfo.io/json", true);
xhr.send();
xhr.onreadystatechange = processRequest;
function processRequest(e) {
if (xhr.readyState == 4 && xhr.status == 200) {
var response = JSON.parse(xhr.responseText);
alert(response.ip);
}
}
</script>
</html>
标签:pen proc highlight class == new 请求 html parse
原文地址:https://www.cnblogs.com/xiaobaichuangtianxia/p/10148870.html