Nicky Peeters
2005-Dec-21 15:12 UTC
Prototype: correct useage of onComplete with Ajax.PeriodicalUpdater
Hello all,
I know it''s a Prototype question, but I hope someone can tell me what
I''m doing wrong (I hope Prototype gets documented soon ;-(
Problem: using a onComplete callback with Ajax.PeriodicalUpdater
(using scriptaculous 1.5 with Prototype 1.4)
Works:
function fooBar() {
Element.hide(''foobar'');
}
new Ajax.Updater(''buddies-and-locations'',
''/ajax-url'',
{ asynchronous:true,
onComplete: function(request) {fooBar();},
onLoading: function(request) {showProgress();},
parameters: params
});
Will not work when using a onComplete callback in the same manner :
new Ajax.PeriodicalUpdater(''buddies-and-locations'',
''/ajax-url'',
{
onComplete: function (request){fooBar()},
onLoading: function(request){ showProgress()},
parameters: params,
asynchronous:true,
decay:2,
frequency:20.0
});
But registering the onComplete using Ajax.Responders DOES work :
Ajax.Responders.register({
onCreate: function() {
if($(''buddies-loading-notice'') &&
Ajax.activeRequestCount>0)
showProgress();
},
onComplete: function() {
if($(''buddies-loading-notice'') &&
Ajax.activeRequestCount==0)
fooBar();
}
});
I tried passing the callback in various forms (return function()...,
this.fooBar().bind(this) etc...)
I worked around the problem using onSuccess in the PeriodicalUpdater
(is that problematic?)
Is it normal that onComplete callbacks do not work in the
Ajax.PeriodicalUpdater ?
Thanks alot,
Nicky Peeters
Maybe Matching Threads
- RE: Prototype: correct useage of onComplete withAjax.PeriodicalUpdater
- RE: Prototype: correct useage of onCompletewithAjax.PeriodicalUpdater
- Ajax.Request: onLoading executed after onComplete in IE
- PeriodicalUpdater onComplete broken?
- dynamically change frequency in periodicalUpdater
