zoukankan      html  css  js  c++  java
  • 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"}}

  • 相关阅读:
    购物菜单
    增删改查
    第七次Android
    第七次作业
    第四次作业
    第二次作业
    第七次
    第二次作业
    第三次作业
    第六周安卓作业
  • 原文地址:https://www.cnblogs.com/Gbeniot/p/4272656.html
Copyright © 2011-2022 走看看