javascript - jQuery getJSON 无法看到 console.log

标签 javascript jquery json getjson

我正在使用以下 get getJSON

$.getJSON("js/production-data.json").done(function(response) {
    console.log(response);
    console.log('hello');
  });

我可以在 Firebug 中看到正在检索数据,但没有用于 响应 的 console.log(这将是整个数据)。我什至也看不到 hello

最佳答案

尝试指定内联回调,例如:

var jqxhr = $.getJSON( "example.json", function() {
  console.log( "success" );
});

作为另一个步骤,添加一个 always 处理程序,而不是仅 done

关于javascript - jQuery getJSON 无法看到 console.log,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24145999/

相关文章:

javascript - JQuery:加载事件如何处理图像?

javascript - 使用带参数的函数更改全局变量 Javascript

jquery - 使用 jQuery 获取叶节点最有效的方法是什么?

javascript - 嵌套在输入中时如何设置复选框的样式

javascript - 根据选项卡内的文本链接的哈希 ID 动态选择 jquery UI 选项卡

php - 使用 javascript/jquery 动态操作 php cookie

php - 我的 android 登录/注册 PHP 服务器出现问题

java - 使用 xstream 反序列化一个 json 数组

java - Android 自定义 ListView 不使用 Volley 构建

Javascript/Easeljs 添加动态文本