开发者

jQuery $.post & $.append & IE6

开发者 https://www.devze.com 2022-12-26 22:22 出处:网络
I\'m having a weird problem with jQuery and IE6. Script works on IE7+ and with all other browsers I have tried it.

I'm having a weird problem with jQuery and IE6. Script works on IE7+ and with all other browsers I have tried it.

I can't post the full script, but what it does is this:

$.post("file.php",{'foo':'bar'},function(data){ $('#target').append(data) })

When I run the code in IE6, #target just shows ? and a white char with a hole in the middle. I have no idea what this second char is.

My initial thought was that this was some sort of content-type problem because the file.php just echoes answer without any header information. I added Content-type: text/html with header() but didn't help.

Any 开发者_Python百科suggestions?


Very probably you see a character set issue.

Add a Content-Type header to your PHP response that correctly reflects both the type and the encoding your data is in.

header('Content-Type: text/html; charset=utf-8;') // for example
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号