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

Ajax y vista de compatibilidad (IE)

Estas en el tema de Ajax y vista de compatibilidad (IE) en el foro de Frameworks JS en Foros del Web. Buenas amigos, tengo una pagina que tiene una aplicacion ajax, conretamente en Internet Explorer, si no clickeo la "vista de compatibilidad" el ajax no anda. ...
  #1 (permalink)  
Antiguo 04/04/2010, 13:17
 
Fecha de Ingreso: octubre-2009
Mensajes: 240
Antigüedad: 14 años, 6 meses
Puntos: 6
Ajax y vista de compatibilidad (IE)

Buenas amigos, tengo una pagina que tiene una aplicacion ajax, conretamente en Internet Explorer, si no clickeo la "vista de compatibilidad" el ajax no anda.

He realizado algunos cambios pero todo sigue igual.
Les dejo el codigo ajax a ver si le debo cambiar algo.
Código:
.
.
.
var url = "tricota.php?num="; 
 
var ajax = getXmlHttpObject(); 

function handleHttpResponse(){ 
    if (ajax.readyState == 1){ 
        document.getElementById('pantalla').innerHTML ="<img src='cargando.gif'>"; 
    } 
    if (ajax.readyState == 4){ 
        results = ajax.responseText; 
        document.getElementById('pantalla').innerHTML = results; 
    } 
} 

function sendQuerystring(curpa){ 
    ajax.open("GET", url + curpa, true); 
    ajax.onreadystatechange = handleHttpResponse; 
    ajax.send(null); 
} 

function getXmlHttpObject(){ 
    var xmlhttp; 

    

    if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){ 
        try{ 
            xmlhttp = new XMLHttpRequest(); 
        } 
        catch (e){ 
            xmlhttp = false; 
        } 
    } 
    return xmlhttp; 
}
Quizas esta no sea la mejor forma de hacer ajax, aviso que cuando le doy click en vista de compatibilidad, funciona todo correctamente.

Saludos.
  #2 (permalink)  
Antiguo 04/04/2010, 14:44
Avatar de Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 17 años, 3 meses
Puntos: 126
Respuesta: Ajax y vista de compatibilidad (IE)

Hola

La función getXmlHttpObject() cambila por esto

Código Javascript:
Ver original
  1. function getXmlHttpObject(){
  2. var xmlhttps = ["Msxml2.XMLHTTP","Msxml2.XMLHTTP.4.0","Msxml2.XMLH TTP.5.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];
  3.     var xmlhttp = false;
  4.     for(var i=0 ; !xmlhttp && i<xmlhttps.length ; i++){
  5.         try{
  6.             xmlhttp = new ActiveXObject(xmlhttps[i]);   // Internet Explorer
  7.         }
  8.         catch(e) {
  9.             xmlhttp = false;
  10.         }
  11.     }
  12.     if(!xmlhttp && typeof XMLHttpRequest!='undefined') {
  13.         xmlhttp = new XMLHttpRequest();  // Firefox, Opera 8.0+, Safari
  14.     }
  15.     return xmlhttp;
  16. }

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />

Etiquetas: ajax, compatibilidad, vistas
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 05:37.