<script>
let xhr = new XMLHttpRequest();
xhr.open("get", "https://tianqiapi.com/api?version=v6&appid=31159757&appsecret=7eANhsA0&city=苏州");
xhr.send();
xhr.responseType = "text";
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
if(xhr.status == 200){
let result = JSON.parse(xhr.response);
let newP = document.createElement("p");
newP.innerHTML = "城市:" + result.city +"<br> 日期:" + result.date +"<br>温度:" +result.tem;
document.body.appendChild(newP);
}
}
}
</script>