The frequency, as defined in the documentation located at , refers to the time interval between the completion of one request and the start of the next request.
To illustrate, consider the following scenario:
function poll()
{
//function body
}
setInterval(poll,2000);
However, the behavior of Ajax.PeriodicalUpdater
differs slightly:
function poll()
{
//function body
setTimeout(poll,2000);
}
poll();
This design choice aims to prevent overwhelming the backend code with frequent requests every 2 seconds, especially when the backend process may take longer than that to execute. Such an approach helps avoid request stacking and delays caused by rapid fire requests.
It is worth considering that you might be misusing Ajax.PeriodicalUpdater
, which essentially acts as a wrapper for Ajax.Updater
responsible for handling content updates. Without more context on your implementation, it seems like the provided code snippet should update the element with the ID message_field
based on the response from your URL request. This update occurs during the onComplete event, following the onSuccess event. If the URL response remains static, unlike the case demonstrated in Jenish Zinzuvadiya's answer, then you are likely to observe such behavior.
I trust this clarification was helpful to you.