bogstaver forvranges når siden kaldes igennem AJAX
HejJeg har en side som jeg opdater med AJAX, men der er nogle problemer med æøå når jeg kalder siden igennem AJAX, men ingen problemer når den hentes normalt...
Min kode ser sådan her ud:
function makeRequest(theurl, elmID, showLoad, clickmenu, pageReload, loadingObj) {
var http_request = "";
theurl = theurl+'&request='+Math.random()+'&ajax=1';
if(loadingObj) {
document.getElementById(loadingObj).style.display = "";
document.getElementById(elmID).style.filter = "alpha(opacity=20)"
}
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
http_request.onreadystatechange = function() { alertContents(http_request, elmID, showLoad, clickmenu, pageReload, loadingObj); };
http_request.open('GET', theurl, true);
http_request.send(null);
}
function alertContents(http_request, elmID, showLoad, clickMenu, pageReload, loadingObj) {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
if(http_request.responseText != "") {
if(elmID != "") {
document.getElementById(elmID).innerHTML = http_request.responseText;
if(loadingObj) {
document.getElementById(elmID).style.filter = "alpha(opacity=100)"
}
}
if(pageReload == 1) {
document.location.reload();
}
}
} else {
document.getElementById(elmID).innerHTML = 'There was a problem with the request. Status: '+http_request.status;
}
} else {
if(showLoad == 1) {
document.getElementById(elmID).innerHTML = 'Loading...';
}
}
}
alle æøå bliver bare firkanter osv.
Nogen som kan hjælpe?