weixin_33739541 2010-06-22 10:44 采纳率: 0%
浏览 31

检索ajax数据时出现问题

I have an issue retrieving ajax data using jquery 1.3.2 / 1.4.2:

  • It works with IE 7/8

  • It fails with FF 3.5/3.6, Chrome 5.0.375.70

The piece of jquery code is very basic:

$.get('http://myhost/someurl',function(data) {
    if (data) {
        alert('data is: ' + data);
    } else {
        alert('no data');
    }
});

With all tested browsers except IE I fall into the ELSE. I compared http headers returns with IE and FF and I can't see what could cause the issue ("test" is actually the data returned by the server):

[with IE]
    HTTP/1.1 200 OK
    Date: Tue, 22 Jun 2010 10:01:32 GMT
    Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.10 with Suhosin-Patch
    X-Powered-By: PHP/5.2.4-2ubuntu5.10
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Content-Length: 4
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Content-Type: text/html

    test

[with FF]
    HTTP/1.1 200 OK
    Date: Tue, 22 Jun 2010 10:01:54 GMT
    Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.10 with Suhosin-Patch
    X-Powered-By: PHP/5.2.4-2ubuntu5.10
    Set-Cookie: PHPSESSID=1777838b6006566fee273bd329463d57; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Content-Length: 4
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Content-Type: text/html

    test

I checked with wireshark and the HTTP response is well-formed (2 x " " between last header and content). Using Firefox, if I inspect the response with HTTPwatch it shows me "test" in the content. However if I look at it with firebug I see nothing. Same behaviour with Chrome degugging tool.

Am I retarded?

Thanks.

  • 写回答

2条回答

  • weixin_33696822 2010-06-22 10:47
    关注

    To be sure of the result of the if statement I would change your control to

    if(data == "test"){..}
    

    or test to null if needed

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题