无法在 IE8 中使用 AJAX 调用加载内容 - Javascript 无法工作
我已经尝试了几乎所有针对此问题的解决方案,但它一直在杀死我(而且它不是轻柔地杀死;))
这是 IE8 报告的错误详细信息:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; AskTbPTV2/5.11.3.15590)
Timestamp: Mon, 18 Apr 2011 07:04:43 UTC
Message: Could not complete the operation due to error c00ce56e.
Line: 265
Char: 3
Code: 0
URI: http://localhost:8080/omiccir/js/ajax_load.js
Message: Could not complete the operation due to error c00ce56e.
Line: 265
Char: 3
Code: 0
URI: http://localhost:8080/omiccir/js/ajax_load.js
这是我的 loadNews 函数:
function loadNews(id) {
xmlhttp = GetXmlHttpObject();
if (xmlhttp == null) {
alert("Your browser does not support Ajax HTTP");
return;
}
var url = "news_show.jsp";
url = url + "?uuid=" + id;
xmlhttp.onreadystatechange = getNewsOutput;
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
}
这是第 265 行:
263: function getNewsOutput() {
264: if (xmlhttp.readyState == 4) {
265: document.getElementById("newsSpan").innerHTML = xmlhttp.responseText;
}
}
这些函数位于名为“ajax_load.js”的文件中
我的 js 函数有什么问题吗?我应该怎么做才能解决这个问题?
编辑----
解决了!
这是我解决这个问题的方法,我打开一个 .txt 文件并将其保存为 utf-8,然后复制 jsp 文件的内容(在本例中涉及此功能“news_show.jsp”)并粘贴将其复制到该.txt文件中,然后单击“另存为”并将其另存为jsp文件并替换旧的文件,然后daaa daaaaaa,问题解决了!
最甜蜜的部分是:虽然jsp文件从一开始就是utf-8,但是执行上面的过程和utf-8ing!就这样,问题解决了!
天哪,我讨厌 IE ;)
I have tried almost all the solutions for this issue, but it keeps killing me (and it is not killing softly ;) )
Here is a error details that IE8 reports :
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; AskTbPTV2/5.11.3.15590)
Timestamp: Mon, 18 Apr 2011 07:04:43 UTC
Message: Could not complete the operation due to error c00ce56e.
Line: 265
Char: 3
Code: 0
URI: http://localhost:8080/omiccir/js/ajax_load.js
Message: Could not complete the operation due to error c00ce56e.
Line: 265
Char: 3
Code: 0
URI: http://localhost:8080/omiccir/js/ajax_load.js
And this is my loadNews function :
function loadNews(id) {
xmlhttp = GetXmlHttpObject();
if (xmlhttp == null) {
alert("Your browser does not support Ajax HTTP");
return;
}
var url = "news_show.jsp";
url = url + "?uuid=" + id;
xmlhttp.onreadystatechange = getNewsOutput;
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
}
And here is line 265 :
263: function getNewsOutput() {
264: if (xmlhttp.readyState == 4) {
265: document.getElementById("newsSpan").innerHTML = xmlhttp.responseText;
}
}
These functions are in a file named "ajax_load.js"
Is there anything wrong with my js functions? What should I do to fix this?
EDIT----
SOLVED!!
here is what i did to solve this issue , i opened a .txt file and saved it as utf-8, then copied the content of my jsp file (which was involved in this feature in this case "news_show.jsp") and pasted it into that .txt file, then click on save-as and saved it as jsp file and replaced the old one, and daaa daaaaaa , problem solved!!!
the sweet part is : although the jsp file was utf-8 from the beginning but doing the above procedure and utf-8ing! it this way , solved the problem!
oh god i hate IE ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题与编码有关。尝试以 utf-8 编码发送响应,以便响应标头包含:
This problem is related to encoding. try to send the responce in utf-8 encoding so that the response header includes:
快速谷歌表明这个问题与文档编码有关。
看看是否可以使用以下内容将适当的 UTF-8 标头添加到响应文档中:
同时确保您的网络服务器配置正确。
A quick google suggests that this is issue is to do with document encoding.
See if you can add appropriate UTF-8 headers to your response document using something like this:
Also make sure your webserver's configured correctly.