I have a jQuery JSON request that downloads some JSON from another server (e.g. foo.com):
$.getJSON("http://foo.com/json.php",function(data) { alert(data); });
But I get the data as null. This is not a problem between domains, I tried the following:
$.getJSON("http://twitter.com/users/usejquery.json?callback=?",
function(data) { alert(data); });
and got a nice JSON object. So, I think there is a problem with backend, Apache 2.2.14. Here are the HTTP headers sent from the server:
Date: Sun, 07 Mar 2010 16:08:38 GMT
Server: Apache/2.2.14 (CentOS)
X-Powered-By: PHP/5.3.1
Content-Length: 2
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: application/json; charset=UTF-8
The headers are the same in every case: a regular HTTP request or AJAX. But I get empty content with AJAX and plain JSON with a browser request. I use Firebug for tests, PHP5 for generating JSON.
Does anyone have any ideas? Thank!
source
share