Prototype.js Ajax.PeriodicalUpdater calls its own function to update

Does anyone know if it is possible for the PeriodicalUpdater to pass the received data to the function I assigned to update the desired field?

I want to process the received data and then update the PeriodicalUpdater field.

+1


a source to share


1 answer


Yes, you can pass an onsuccess callback to it as you would for 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 Parameters .

+5


a source







All Articles