我正在使用此代码:
$.getJSON(url, function(data) {
console.log(data);
}, "json");
现在,控制台中没有记录任何内容,但我可以在Chrome的网络标签中看到响应。这有什么理由吗?回调是错误的吗?
答案 0 :(得分:1)
最后摆脱, "json"
。否则,"json"
将成为回调函数。
$.getJSON(url, function(data)
{
console.log(data);
});
而不是getJSON
你可以使用
$.get(url, function(data)
{
console.log(data);
}, "json");