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

Detener peticion

Estas en el tema de Detener peticion en el foro de Frameworks JS en Foros del Web. Hola a todos, Publique esta pregunta en javascript, pero es probable que pertenezca mejor en esta seccion: Quisiera solicitar su ayuda con una coneccion implementada ...
  #1 (permalink)  
Antiguo 20/07/2010, 19:17
Avatar de SPAWN3000  
Fecha de Ingreso: marzo-2008
Ubicación: Bogota
Mensajes: 858
Antigüedad: 16 años
Puntos: 15
Detener peticion

Hola a todos,

Publique esta pregunta en javascript, pero es probable que pertenezca mejor en esta seccion:

Quisiera solicitar su ayuda con una coneccion implementada con prototype.
Mi problema es que siempre matiene haciendo peticiones pero en un momento dado se necesita para su ejecucion y despues de un tiempo inciarla nuevamente.


Dejo el script que enconte en internet:

Código:
<script type="text/javascript">
var posc=0;
var comet = {
  connection   : false,
  iframediv    : false,

  initialize: function() {
    if (navigator.appVersion.indexOf("MSIE") != -1) {
      // For IE browsers
      comet.connection = new ActiveXObject("htmlfile");
      comet.connection.open();
      comet.connection.write("<html>");
      comet.connection.write("<script>document.domain = '"+document.domain+"'");
      comet.connection.write("</html>");
      comet.connection.close();
      comet.iframediv = comet.connection.createElement("div");
      comet.connection.appendChild(comet.iframediv);
      comet.connection.parentWindow.comet = comet;
      comet.iframediv.innerHTML = "<iframe id='comet_iframe' src='./backend.php'></iframe>";

    } else if (navigator.appVersion.indexOf("KHTML") != -1) {
      // for KHTML browsers
      comet.connection = document.createElement('iframe');
      comet.connection.setAttribute('id',     'comet_iframe');
      comet.connection.setAttribute('src',    './backend.php');
      with (comet.connection.style) {
        position   = "absolute";
        left       = top   = "-100px";
        height     = width = "1px";
        visibility = "hidden";
      }
      document.body.appendChild(comet.connection);

    } else {
      // For other browser (Firefox...)
      comet.connection = document.createElement('iframe');
      comet.connection.setAttribute('id',     'comet_iframe');
      with (comet.connection.style) {
        left       = top   = "-10px";
        height     = width = "10px";
        visibility = "hidden";
        display    = 'none';
      }
      comet.iframediv = document.createElement('iframe');
      comet.iframediv.setAttribute('src', './backend.php');
      comet.connection.appendChild(comet.iframediv);
      document.body.appendChild(comet.connection);

    }
  },

  // this function will be called from backend.php  
  printServerTime: function (time) {
		var temp = new Array();
		temp = time.split('!'); 
		document.getElementById('totalr').value = temp[0];
		$('contenttable').innerHTML = temp[1];
  },

  onUnload: function() {
    if (comet.connection) {
      comet.connection = false; // release the iframe to prevent problems with IE when reloading the page
	  flush();
    }
  }
}
Event.observe(window, "load",   comet.initialize);
Event.observe(window, "unload", comet.onUnload);
</script>

De antemano mil gracias,

Etiquetas: ajax, detener, peticion
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.
Tema Cerrado




La zona horaria es GMT -6. Ahora son las 15:14.