开发者

Trouble with dynamic AJAX in IE?

I have the following problem: I'm filling the content of some elements using AJAX, when the user selects some option in one , then the second updates its content from the server. When the answer arrives -with Content-Type set to text/xml, I rebuild the options list in the second element (pretty basic stuff actually).

The problem is that Internet Explorer throws an error when parsing the XML answer. In the rest of the browsers (Firefox, Opera, safari and Chrome) this script works great, but not in IE, it stills throws an error when it finds a spanish character ('ñ'). Again, I already stated the right encoding in the headers.

As an alternative i tried to change the Content Type of the answer to plain text, and then update the ´innerHTML´ property of the elements. I tried something like this:

select-element.inne开发者_StackOverflow中文版rHTML = response-text;

This alternative once again seems to work perfectly in all the browsers but IE, where the property gets updated but the browser does not shows any change.

Is anyone able to help me please? I would accept the answer to any of the two alternatives, but specially the second one (its kind of faster).

Thank you in advance! Joshua.


You seem to recognize that the answer is almost certainly that you didn't, in fact, specify the correct encoding in the headers. Please update your question with a sniff (e.g. use Fiddler) of the headers received, or provide the URL of a site that reproduces this problem.

You might also want to check out http://blogs.msdn.com/b/ieinternals/archive/2011/02/28/script-error-c00ce56e-means-you-have-specified-an-invalid-charset-utf8-is-not-utf-8.aspx.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜