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.


Thanks


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

Open in new window

CodeFlashAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
Ajax.PeriodicalUpdater
http://www.prototypejs.org/api/ajax/periodicalUpdater

"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){
        $('datetime').innerHTML=t.responseText;
    }
   });

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.