ajax 206,javascript - empty response body in ajax (or 206 Partial Content) - Stack Overflow

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!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值