Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/05/2009, 08:08
Avatar de ZiTAL
ZiTAL
 
Fecha de Ingreso: marzo-2004
Ubicación: Bermio (Bizkaia)
Mensajes: 1.545
Antigüedad: 20 años, 2 meses
Puntos: 62
Respuesta: Ajax asincrono problemas con Internet explorer

Entonces quedaría algo como:
Código javascript:
Ver original
  1. ...
  2. ...
  3.     // request public method
  4.     this.request = function()
  5.     {
  6.         var t = this;
  7.         var a = new xmlhttp();                      // get xmlhttp object
  8.         var b = setHeader(t.method, t.charset);     // set get/post different headers
  9.         setQuery(t);                                // construct get/post different properties
  10.         t.onRequest();                              // Method to do before all process
  11.         a.open(t.method, t.page, t.async);          // open ajax petition
  12.         a.setRequestHeader('Content-Type', b);      // set headers ALWAYS after OPEN
  13.         getState(t, a);                             // ajax reponse state
  14.     };
  15. ...
  16. ...
  17. ...
  18.     // private method to set ajax petition state
  19.     var getState = function(t, a)
  20.     {
  21.         if(t.async)
  22.         {
  23.             a.onreadystatechange = function() // get petition changestates
  24.             {
  25.                 switch (a.readyState) {
  26.                     case 1: // if readystate is 1 The request has been set up
  27.                         t.onSetUp();
  28.                         break;
  29.                     case 2: // if readystate is 2 The request has been sent
  30.                         t.onSend();
  31.                         break;
  32.                     case 3: // if readystate is 3 The request is in process
  33.                         t.onProcess();
  34.                         break;
  35.                     case 4: // if readystate is 4 the request is complete
  36.                         reqResponse(t, a);
  37.                         break;
  38.                 }
  39.             };
  40.             a.send(t.query);                                // send get/post query     
  41.         }
  42.         else
  43.         {
  44.             a.send(t.query);                                // send get/post query     
  45.             reqResponse(t, a);
  46.         }
  47.     };
  48. ...
  49. ...
__________________
http://zital.no-ip.org
____________________

Euskerie ahuen eta bijotzan