ajax 请求解析josn

其实代码很简单,主要是这么模拟测试数据,例如在GitHub page上建个data.json我们请求

https://naiop.github.io/test/data.json
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Ajax请求</title>
    </head>
    <body>
      <h2>打开控制台查看详情</h2>
    </body>
    <script src="https://common.cnblogs.com/scripts/jquery-2.2.0.min.js"></script>
    <script>
    $(function(){
        console.log("Ajax");    
         $.ajax({
            type: "GET",
            url: "https://naiop.github.io/test/data.json",                      
            dataType: "json",
            success: function (res) {
                
               console.log(res);               
            },
            error: function (err) {
               console.log(err);
            }
        });        
    });
    </script>
</html>