我使用jQuery 1.3.2/1.4.2的问题AJAX检索数据:问题检索AJAX数据
它与IE 7/8
它失败,FF 3.5/3.6时,Chrome 5.0.375.70
该件的jQuery代码是非常基本的:
$.get('http://myhost/someurl',function(data) {
if (data) {
alert('data is: ' + data);
} else {
alert('no data');
}
});
除IE之外的所有测试过的浏览器都属于ELSE。 我比较HTTP标头与IE和FF回报,我看不出有什么可能导致问题(“测试”实际上是由服务器返回的数据):我使用Wireshark检查
[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
和HTTP响应是格式良好的(最后一个标题和内容之间有2 x“\ r \ n”)。使用Firefox,如果我使用HTTPwatch检查响应,它会向我显示内容中的“测试”。但是,如果我用萤火虫看它,我什么都看不到。使用Chrome浏览器的定位工具的行为相同。
我是否智障?
谢谢。
“测试”是有效的html数据。 if语句也是有效的。 正确的答案是帕特里克的,因为我的确在从系统测试并向外部服务器发送ajax请求。 – Max 2010-06-22 13:56:57