【问题标题】:jQuery getJSON reported undefined function errorjQuery getJSON 报未定义函数错误
【发布时间】:2019-02-24 11:25:28
【问题描述】:

我正在尝试在页面加载时加载 json 文件。所以我尝试了这段代码:

$( document ).ready(function() {
    $.getJSON("./db/url.json", function(json) {
        console.log(json); 
    });
    console.log("The page is loaded"); 
});

导致这个错误:

 [Show/hide message details.] TypeError: $.getJSON is not a function[Learn More]

我读了一些类似的帖子,但我仍然无法弄清楚。你能帮忙吗?

如果我使用$.ajax,结果相同

【问题讨论】:

    标签: jquery undefined getjson


    【解决方案1】:

    确保您不使用slim 版本(差异在附加的链接中)。 slim 版本不包含.ajax.getJSON

    jquery-3.1.1.min.js 的完整版可以在here找到。

    测试它并检查结果。

    【讨论】:

    • 太好了,谢谢!我不知道苗条版本的不同。
    猜你喜欢
    • 2010-09-25
    • 2010-11-29
    • 2020-06-30
    • 1970-01-01
    • 2013-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-11
    相关资源
    最近更新 更多