Ajax Periodical Refresh

I am using a simple periodical refresh with ajax and the prototype.js that I've read about online. It works smoothly when the file is there, but if the data is being updated, say for instance I upload an html file I want it to refresh (page.htm) it refreshes fine until the ftp is uploading the file the same time it tries to update the data, then it errors out.

I know there are status checks in ajax, and have been reading about them the last day or two, but could anyone show me how to apply one to this? If the page isnt available for refresh I'd like for it to not refresh and to keep what was there before there until the refresh can pull the new data through after it's updated.


new Ajax.PeriodicalUpdater('datetime', 'page.htm', {
     method: 'get', frequency: 5, decay: 2

Open in new window

Who is Participating?

"Ajax.PeriodicalUpdater features all the [common options <= LINK(http://www.prototypejs.org/api/ajax/options)] "
so there, you need to look at the ajax options to understand the options available to this method.

So try:
new Ajax.PeriodicalUpdater('', 'page.htm', {
     method: 'get'
     , frequency: 5
     , decay: 2
     , onSuccess:function(t){

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.