(resolved) empty response body in ajax (or 206 Partial Content)

Posted by Nikita Rybak on Stack Overflow See other posts from Stack Overflow or by Nikita Rybak
Published on 2010-05-01T22:01:20Z Indexed on 2010/05/02 2:27 UTC
Read the original article Hit count: 318

Filed under:
|
|

Hi guys,

I'm feeling completely stupid because I've spent two hours solving task which should be very simple and which I solved many times before. But now I'm not even sure in which direction to dig.

I fail to fetch static content using ajax from local servers (Apache and Mongrel). I get responses 200 and 206 (depending on the server), empty response text (although Content-Length header is always correct), firebug shows request in red.

Javascript is very generic, I'm getting same results even here: http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_first (just change document location to 'http://localhost:3000/whatever') So, it's probably not the cause.

Well, now I'm out of ideas. I can also post http headers, if it'll help.

Thanks!

Response Headers
Connection  close
Date    Sat, 01 May 2010 21:05:23 GMT
Last-Modified   Sun, 18 Apr 2010 19:33:26 GMT
Content-Type    text/html
Content-Length  7466

Request Headers
Host    localhost:3000
User-Agent  Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive  115
Connection  keep-alive
Referer http://www.w3schools.com/ajax/tryit_view.asp
Origin  http://www.w3schools.com

Response Headers
Date    Sat, 01 May 2010 21:54:59 GMT
Server  Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2 mod_jk/1.2.28
Etag    "3d5cbdb-fb4-4819c460d4a40"
Accept-Ranges   bytes
Content-Length  4020
Cache-Control   max-age=7200, public, proxy-revalidate
Expires Sat, 01 May 2010 23:54:59 GMT
Content-Range   bytes 0-4019/4020
Keep-Alive  timeout=5, max=100
Connection  Keep-Alive
Content-Type    application/javascript

Request Headers
Host    localhost
User-Agent  Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive  115
Connection  keep-alive
Origin  null

UPDATED:
I've found a problem, it was about cross-domain requests. I knew that there are restrictions, but thought they're relaxed for local filesystem and local servers. (and expected more descriptive error message, anyway)
Thanks everybody!

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about http