10/04/2008, 16:50
|
| $this->role('moderador'); | | Fecha de Ingreso: mayo-2006 Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años, 6 meses Puntos: 2135 | |
Re: Problema al redireccionar a otra pagina, al finalizar llamada Ajax Prueba usando prototype, esto:
Código:
Ajax.PeriodicalAjax = Class.create(Ajax.Base, {
initialize: function($super, url, options) {
$super(options);
this.onComplete = this.options.onComplete;
this.frequency = (this.options.frequency || 2);
this.decay = (this.options.decay || 1);
this.updater = { };
this.url = url;
this.start();
},
start: function() {
this.options.onComplete = this.updateComplete.bind(this);
this.onTimerEvent();
},
stop: function() {
this.updater.options.onComplete = undefined;
clearTimeout(this.timer);
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
},
updateComplete: function(response) {
if (this.options.decay) {
this.decay = (response.responseText == this.lastText ?
this.decay * this.options.decay : 1);
this.lastText = response.responseText;
}
this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
},
onTimerEvent: function() {
this.updater = new Ajax.Request(this.url, this.options);
}
});
function Rellenar_Bd( url ) {
var theURL = url + "&" + Math.random();
$('contenedor').style.height="650px";
Element.show('contenedor');
new Ajax.PeriodicalAjax(theURL, {
method: 'get',
frequency: 0.7,
decay: 1,
onSuccess: function(res) {
if( res.responseText == "1" ) {
Element.hide('loading_tablas');
window.location = 'index.php?seccion=2&act=3';
}
}
});
}
Saludos. |