Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Ajax y firefox

Estas en el tema de Ajax y firefox en el foro de Frameworks JS en Foros del Web. Hola tengo una web que carga datos mediante ajax. La web funciona correctamente en IE pero no asi en FIREFOX. He estado buscando pero no ...
  #1 (permalink)  
Antiguo 17/09/2007, 04:21
 
Fecha de Ingreso: octubre-2003
Mensajes: 364
Antigüedad: 20 años, 6 meses
Puntos: 1
Ajax y firefox

Hola tengo una web que carga datos mediante ajax. La web funciona correctamente en IE pero no asi en FIREFOX.

He estado buscando pero no encuentro la solución.

Mi código es el siguiente:

Código:
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 mostrar(id){
	ajax=objetoAjax();	
	divResultado = document.getElementById('light');
	ajax.open('get', 'mostrar.php?id='+id,false);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML=ajax.responseText;			
		}
	}
	ajax.send(null)
}

Última edición por Agrey; 17/09/2007 a las 04:31
  #2 (permalink)  
Antiguo 17/09/2007, 04:39
 
Fecha de Ingreso: octubre-2003
Mensajes: 364
Antigüedad: 20 años, 6 meses
Puntos: 1
Re: Ajax y firefox

Hola,
Lo he solucionado poniendo en esta linea ajax.open('get', 'mostrar.php?id='+id,false); en vez de false, true. Y ahora funciona tanto en IE como firefox.

Pero ahora me ha surgido la duda de los acentos.

He leido que se puede solucinar poniendo

Código:
echo htmlentities($row["eve_nombre"]);
Es esta una buena solución o las hay mejores.

Un saludo
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:44.