Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/04/2010, 03:33
davicito
 
Fecha de Ingreso: marzo-2009
Mensajes: 480
Antigüedad: 15 años, 5 meses
Puntos: 1
Tildes o ñ, no salen al pasar archivo ajax

Hola Señores.

Bueno tras diversos días de no poder solucionar el tema y descubrir que es por el AJAX. Me pongo en contacto con vosotros a ver si de una vez por todas consigo solucionar el tema...

Tengo una url que me dirije a un div, y eso va en Ajax:
Código PHP:
function objetoAjax(){
 var 
xmlhttp=false;
  try{
   
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }catch(
e){
   try {
    
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   }catch(
E){
    
xmlhttp false;
   }
  }
  if (!
xmlhttp && typeof XMLHttpRequest!='undefined') {
   
xmlhttp = new XMLHttpRequest();
  }
  return 
xmlhttp;
}

function 
llama_buscador_avanzado(){
 var 
divContenido document.getElementById('contenido_informacion');
 
ajax=objetoAjax();
 
ajax.open('GET''buscador_avanzado.php',true);
 
ajax.onreadystatechange=function() {
  if (
ajax.readyState==&& (ajax.status == 200 || ajax.status == 304)) {
   
//mostrar resultados en esta capa
   
divContenido.innerHTML ajax.responseText
  
}
 }
ajax.send(null)



De hay va a este archivo.php

Código PHP:
<? session_start(); include("conec.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es-es">
<head>
<title>ón-line e_VetCop</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="styles.css" type="text/css" />
<script type="text/javascript" src="javascript/funciones_ajax.js"></script>
</head>
<body>
etó es un émeplo<br />
<? echo 'esá es otrá prueba'?>    
</body>
</html>
Como podeis ver es un archivo sencillo. No tiene nada complicado.
El archivo cuando lo habro en una ventana normal y corriente sin pasar por AJAX, todo sale correctamente, con sus tildes y ñ. Pero si lo abro con ajax hay surge el problema.

¿Sabeis porque puede ser?
Un saludo y gracias