Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/02/2015, 08:43
Pimager
 
Fecha de Ingreso: julio-2010
Mensajes: 298
Antigüedad: 13 años, 10 meses
Puntos: 8
Problema con petición AJAX en Javascript

Hola a todos,
Estoy teniendo problemas al hacer una petición AJAX con Javascript en IE11. Pongo el código a continuación:
Código:
function ajaxFunction(url, params, ret_fun_ok, ret_fun_nook)
{
   var xmlHttp = createXMLHttp(); 
   xmlHttp.open("POST", url, true);
   //Send the proper header information along with the request
   xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

   xmlHttp.onreadystatechange = function ext2(){
      if ( xmlHttp.readyState == 4 ) {
         if ( xmlHttp.status == 200 ) {
            ret_fun_ok(xmlHttp.responseText);
         } else {
            ret_fun_nook(xmlHttp.status);
         }
      }
   };
   xmlHttp.send(params);
}
function createXMLHttp() 
{
   if (typeof XMLHttpRequest != 'undefined')
      return new XMLHttpRequest();
   else if (window.ActiveXObject) {
      var avers = ["Microsoft.XmlHttp", "MSXML2.XmlHttp","MSXML2.XmlHttp.3.0", "MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.5.0"];
      for (var i = avers.length -1; i >= 0; i--) {
         try {
         httpObj = new ActiveXObject(avers[i]);
         return httpObj;
         } catch(e) {}
      }
   }
   throw new Error('XMLHttp (AJAX) not supported');
}
function ajaxOnTrue(result) {
   alert(result);
}
function ajaxOnFalse(status) {
   alert(status);// status = 0
}
ajaxFunction('https://www.myserverdomain.com/services/Request.ashx', "param1=value1&param2=value2", ajaxOnTrue, ajaxOnFalse);
Por lo que veo en el servidor, siempre devuelve un código 200, pero cuando llega la petición al PC del usuario final, mmuestra un "xmlHttp.status=0", alguien sabe a que se debe? Sólo me sucede en IE11.

Muchas gracias por la ayuda