Ver Mensaje Individual
  #12 (permalink)  
Antiguo 07/06/2007, 10:07
sanref
 
Fecha de Ingreso: mayo-2004
Mensajes: 189
Antigüedad: 20 años
Puntos: 1
Re: AJAX no funciona en FireFox (si en Explorer)

Te paso como lo tengo yo y me funciona en IE y FF

Código:
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest

function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; }
       }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       try {
          xmlhttp = new XMLHttpRequest();
       } catch (e) { xmlhttp = false; }
    }
    return xmlhttp;
}

function cargar_combo() {
	if (http) {
		   http.open("POST", "pagina_que_llamas.asp", true);
		   http.onreadystatechange = handleHttpResponse;
		   http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		   http.send("aca podes mandar datos a pagina_que_llamas.asp");
	}
}

function handleHttpResponse() {
	if (http.readyState==1) {
			/* aca podes mostrar un mensaje (wait...)*/	
	} 
    if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
             	/*aca tomas los datos que te manda pagina_que_llamas.asp y hace lo que tengas que hacer*/
                        div.innerHTML = http.responseText;
                          /*div es el lugar donde mostras lo que te devuelve*/
				
          }
       }
    }
}
espero te sirva.
Saludos
__________________
Nadie nacío sabiendo...