Reputation: 8496
Anyone know if it is possible to make the PeriodicalUpdater pass the data it received to a function I assign to update the desired field?
I want to process the data I receive and then have the PeriodicalUpdater function update the field.
Upvotes: 1
Views: 2289
Reputation: 51488
Yes, you can pass it an onsuccess callback, just like you do for a any other AjaxRequest.
new Ajax.PeriodicalUpdater('container', '/someurl', {
method: 'get',
frequency: 3,
decay: 2;
onsuccess: function(response){
myCustomFunction(response.responseText);
}
});
function myCustomFunction(data){
/* do something */
}
See Ajax.PeriodicalUpdater and Ajax Options.
Upvotes: 5