JSON (仅限本地)

  <script type="text/javascript">  
setInterval(function() {
    $("#content").load(location.href+" #content>*","");
}, 2000);
</script>
  <script type="text/javascript">
var xmlhttp = new XMLHttpRequest();
var url = "http://www.weather.com.cn/data/sk/101110101.html";

xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        myFunction(xmlhttp.responseText);
    }
}
xmlhttp.open("post", url, true);
xmlhttp.send();

function myFunction(response) {

  obj = JSON.parse(response);
  document.getElementById("demo").innerHTML =
  obj.weatherinfo.city + " " + obj.weatherinfo.cityid;
}

</script>

  <i id="demo">

 

 

{"weatherinfo":{"city":"西安","cityid":"101110101","temp":"7","WD":"东风","WS":"2级","SD":"21%","WSE":"2","time":"15:00","isRadar":"1","Radar":"JC_RADAR_AZ9290_JB","njd":"27400","qy":"985"}}

转载于:https://www.cnblogs.com/Gbeniot/p/4272656.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值