我使用以下 jQuery 从 x 服务器获取一些 JSON:
$(function(){
$.getJSON("/json.php?method=getStupid&jsoncallback=?",
function(json){
console.log('Success: ' + json);
}
);
});
每个浏览器的控制台都是空的,但是当我检查网络选项卡时,它似乎一切正常。
HTTP/1.1 200 OK
Date: Mon, 04 Feb 2013 14:14:01 GMT
Server: Apache/2.2.16 (Debian)
X-Powered-By: PHP/5.3.3-7+squeeze9
Cache-Control: no-cache, must-revalidate
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Content-Length: 33
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: application/json
这就是响应的样子:
({"a":1,"b":2,"c":3,"d":4,"e":5})
感觉 function(json) { } 中的所有内容都被忽略了。是错字吗?