首页 > Web开发 > 详细

HTML页面直接显示json 结构

时间:2017-10-17 14:38:27      阅读:286      评论:0      收藏:0      [点我收藏+]
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">
        #songResJson{
            border: 1px solid #8d8c8c;
            padding: 5px;
            white-space: pre-wrap;
            word-wrap: break-word;
        }
    </style>
</head>
<body>
    <div class="apiResult">
    <h2> json 数据</h2>
    <pre id="songResJson"></pre>  
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script>
    var data = {
        "ret": 0,
          "msg": "success",
          "data": []
    };
    $("#songResJson").text(JSON.stringify(data,null,2)); 
</script>
</body>
</html>

结构展示

技术分享

 

HTML页面直接显示json 结构

原文:http://www.cnblogs.com/AllenChou/p/7680918.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!