简体   繁体   English

IE6的jQuery ajax问题

[英]jQuery ajax problem with IE6

Hi my problem is a bit wired: 嗨,我的问题有点有线:

my $.ajax success handler looks like: 我的$ .ajax成功处理程序如下所示:

function(data){
        alert(data);
}

Pretty simple, yeah? 很简单,是吗?

The problem is that data IS ALWAYS 3 character long - no matter what was sent by the server! 问题是数据总是3个字符长-无论服务器发送了什么! The characters: 31 65535 8 (using charCodeAt()). 字符:31 65535 8(使用charCodeAt())。

In other browsers (even in IE 8) all works fine. 在其他浏览器中(甚至在IE 8中),一切正常。

I've looked at xhr.responseText in complete handler - just the same result. 我在完整的处理程序中查看了xhr.responseText-相同的结果。

UPDATE Full http response UPDATE完整的http响应

HTTP/1.1 200 OK
Date: Sun, 07 Feb 2010 13:35:39 GMT
Server: Apache/2.2.12 (Ubuntu)
X-Powered-By: PHP/5.2.10-2ubuntu6.4
Set-Cookie: 1111111111111111=UjVXb1Q3WTdUIQ8jXmALbA88VzpRcVcgBzMDcldyUmtWawAyAFpQP1IwASEAbFh%2FDjoLZ1RiBWlWdwBnUGMHZlU2UGBTZFA5B2UMMlJgC29SbVdjVDRZOVRsDzReaQtuDzpXZVFjV2UHYwM1VzNSNlYzAG4AMVAwUjUBIQBsWH8OOgtlVGAFaVZ3AD5QIgdcVWVQNlNhUHIHMAwjUiQLL1JvVyZUOVk8VGkPal54C2wPNVcyUX1XYgdgAzlXL1IzVioAbQA3UG9SdgE4ACRYNg4xC2RUagVxViAAJFA3B3FVW1AzU2JQZQc7DCRSdQs2UidXb1Q2WT1UYA9yXhcLMg92V2lRP1c%2FBzcDLlc1UixWNAB8AC1QNVI7AW4AJ1htDnQLPVQyBT9WMABsUHIHTlVXUBtTQFAgB20MflJnCzZSdFcCVGpZY1Q%2BDz9eLQsuDyxXTlEHV3MHYAMvVzBSOVYmAGcAdlBsUmUBMABtWC4ObAs1VCMFJ1YKADZQMQd3VW1QJFNsUHQHLAxyUmwLflJuV2RUM1k3VHgPYV5oC2sPOVc1UWdXagdgAzBXOVIgVj8AIQ%3D%3D; expires=Tue, 07-Feb-2012 13:35:39 GMT; path=/
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 21
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html

1

UPDATE ! 更新! Well, problem temporary? 好吧,暂时的问题? solved by disabling gzip in .htaccess 通过禁用.htaccess中的gzip解决

The characters you get look weird, but could it be that it's a BOM ? 您得到的字符看起来很奇怪,但这可能是BOM吗? It's none of the ones listed in the article, but maybe getCharCode() gets something wrong. 它不是本文列出的内容,但也许getCharCode()出错了。

In that case, you would have to check the script you call to request the data. 在这种情况下,您将必须检查调用的脚本以请求数据。 Try saving it explicitly without a BOM. 尝试显式保存而不使用BOM表。

this is most times an problem with propper encoding of the requested content / displayed content. 这通常是对请求的内容/显示的内容进行适当编码的问题。

Please verify that both use the same format. 请确认两者使用相同的格式。

Despite ajax is always done in UTF-8 some implementations are weird and they don't allow passing non ascii characters. 尽管ajax总是在UTF-8中完成,但某些实现却很奇怪,并且它们不允许传递非ascii字符。 You have to change them to entities. 您必须将它们更改为实体。

If You pass only one character and still get problems - It might be the BOM mentioned by Pekka. 如果您仅传递一个字符仍然遇到问题-可能是Pekka提到的BOM。 You would have to save Your PHP FILE without any spaces before 您必须先保存您的PHP文件,不得包含任何空格

Second thing is that You might be outputing something at the end of the php file. 第二件事是您可能在php文件的末尾输出了一些内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM