HTML頁面直接顯示json 結構


<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>

結構展示

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM