A fairly simple code for using Ajax.PeriodicalUpdater is offered in the API description on the prototype official site.
new Ajax.PeriodicalUpdater ('items', '/ items', {
method: 'get', frequency: 3, decay: 2
});
Everything seems to be fine, but today I stumbled upon a rake when working in IE, namely, the script did not fulfill its intended purpose - it did not update the container by timer.
')
I was looking for a solution for a long time and hard, but I didn’t find anything intelligible in the runet (maybe I didn’t look for it as long and hard as I would need). But having rummaged through Zabugorsky sites I came across the following article:
blog.innerewut.de/2007/9/22/ie-doesn-t-let-us-restAnd then the problem was solved in the following way:
new Ajax.PeriodicalUpdater ('items', '/ items', {
method: 'post', frequency: 3, decay: 2
});
IE, simply, caches GET requests in ajax (including with PeriodicalUpdater). You can win either by sending different parameters with each GET request, or use POST. This solution removes all problems and allows us to update the container we need in all browsers. Hooray! (:
PS when programming in Ruby, switching to POST is not so easy, so you have to tinker - as shown in the article
blog.innerewut.de/2007/9/22/ie-doesn-t-let-us-rest .
x-posted:
n0ns3ns3.livejournal.com/236264.html