ajax请求本地json文件.html

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ajax2</title>

    <script src="js/jquery-1.11.3.js"></script>
</head>

<body>
    <script>
        $.ajax({
            // url貌似不能是本地的绝对路径。此处是相对路径。
            url: "./data/bimYiYuanRvt/scenetree.json",
            dataType: 'json',
            data: { x: new Date() },
            success: function(scenetree) {
                console.log("scenetree:", scenetree);
            }
        }); 
    </script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_42193179/article/details/88689786