Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/10/2010, 05:45
SeaPirates
 
Fecha de Ingreso: enero-2009
Ubicación: España
Mensajes: 786
Antigüedad: 15 años, 3 meses
Puntos: 9
Caracteres raros al usar ajax

Al usar el siguiente script me devuelve accentos, ñ interrogaciones y demás con caracteres raros, he intentado buscar la solución pero no hay modo, que puedo hacer?

Código:
<script>

var seconds = 0.1;
var divid = "timediv";
var url = "MostrarMensajes.php";



function refreshdiv(){



var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("Tu explorador no soporta AJAX.");
return false;
}
}
}



fetch_unix_timestamp = function()
{
return parseInt(new Date().getTime().toString().substring(0, 10))
}

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"?t="+timestamp;



xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById(divid).innerHTML=xmlHttp.responseText;
setTimeout('refreshdiv()',seconds*1000);
}
}
xmlHttp.open("GET",nocacheurl,true);
xmlHttp.send(null);
}



window.onload = function startrefresh(){
setTimeout('refreshdiv()',seconds*1000);
}
</script>

<div name="timediv" id="timediv">
</div>