Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/01/2012, 14:44
Avatar de Pelipe
Pelipe
 
Fecha de Ingreso: abril-2011
Ubicación: Nuestra Señora de La Paz
Mensajes: 90
Antigüedad: 13 años
Puntos: 4
Carga en proceso no me carga en Safari y Chrome

Soy novatin en esto del ajax pero en si funciona... pero mientras realiza la peticion no me muestra el GIF de cargando en Safari y Chrome.. pero si lo hace en IE6 y 9, en Opera y Firefox.

Este es mi script:

Código Javascript:
Ver original
  1. function createREQ() {
  2.     try {
  3.         req = new XMLHttpRequest(); /* p.e. Firefox */
  4.     } catch(err1) {
  5.         try {
  6.         req = new ActiveXObject('Msxml2.XMLHTTP'); /* algunas versiones IE */
  7.         } catch (err2) {
  8.             try {
  9.             req = new ActiveXObject("Microsoft.XMLHTTP"); /* algunas versiones IE */
  10.             } catch (err3) {
  11.             req = false;
  12.             }
  13.         }
  14.     }
  15.     return req;
  16. }
  17.  
  18. var http = createREQ();
  19.  
  20. function agregar(id) {
  21.     var miAleatorio = parseInt(Math.random()*99999999);
  22.     var url = "Apoyo/agregar.php?id=" + id;
  23.     http.open("GET", url + "&rand=" + miAleatorio, true);
  24.     http.onreadystatechange = respuestaAjax(id);
  25.     http.send(null);
  26. }
  27. function respuestaAjax(id) {
  28.     if (http.readyState == 4) {
  29.         if (http.status == 200) {
  30.             var miTexto = http.responseText;
  31.             var brazo = document.getElementById("Producto_ESTADO_" + id);
  32.             brazo.innerHTML = miTexto;
  33.         } else {
  34.             alert("Ha ocurrido un error: " + http.statusText);
  35.         }
  36.     } else {//cargar animacion mientras se realiza la operacion ajax
  37.         document.getElementById("Producto_ESTADO_" + id).innerHTML = "<div id='Producto_OCUPADO'><img src='Apoyo/cargando.gif' width='22' height='22' /></div>";
  38.     }
  39. }


¿que puede ser amigos?