码迷,mamicode.com
首页 > Web开发 > 详细

json如何获取内容

时间:2017-07-01 17:23:41      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:doctype   func   w3c   center   charset   back   rate   ext   http   

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>复习</title>
        <style type="text/css">
            .myclass {
                border: 0px;
            }
        </style>
        <script src="js/jQuery1.11.1.js"></script>
        <script src="js/jquery-migrate-1.2.0.js"></script>
        <script type="text/javascript">
            $(function(){
                /*  var data={"firstName": "John","lastName": "Mr"};
                 $.each(data,function(i,dom){
                   alert(dom);
                 }); */



                /* var data={
                        "people":[
                            {
                            "firstName": "张靓颖",
                            "lastName":"Mrs"
                            },
                            {
                            "firstName":"李小龙",
                            "lastName":"Mr"
                            }
                            ]
                        };
                        
              $.each(data.people,function(i,dom){
                  alert(dom.firstName+"\t"+dom.lastName);
              }); */    
              
              
              var data={
                "name": "中国",
                "province": [{
                    "name": "黑龙江",
                    "cities": {
                        "city": ["哈尔滨", "大庆"]
                    }
                }, {
                    "name": "广东",
                    "cities": {
                        "city": ["广州", "深圳", "珠海"]
                    }
                }, {
                    "name": "台湾",
                    "cities": {
                        "city": ["台北", "高雄"]
                    }
                }, {
                    "name": "新疆",
                    "cities": {
                        "city": ["乌鲁木齐"]
                    }
                }]
            };
            
            $.each(data.province,function(i,dom){
               alert(dom.cities.city);
            });
                          
              
                            
            });
            
            
        </script>
    </head>
    <body>
        <center>
           
        </center>
    </body>
</html>

 

json如何获取内容

标签:doctype   func   w3c   center   charset   back   rate   ext   http   

原文地址:http://www.cnblogs.com/alexanderthegreat/p/7102693.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!