Cant load content with AJAX call in IE8 - Javascript wont work
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 ;)
This problem is related to encoding. try to send the responce in utf-8 encoding so that the response header includes:
Content-type: text/html; charset=ISO-8859-1
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:
<%@ page contentType="text/html; charset=UTF-8" %>
Also make sure your webserver's configured correctly.
精彩评论