How to autorefresh a TXT file on website

Hello experts

We have a .txt file on our webserver that is refreshed every 20 sec for aprox 3 or 4 hours. After that the file is no longer updated. When the user clicks on the link it will open that .txt file however to get the latest update the user will need to refresh the browser. Around 90% of our users will be using cell phones or tablets.

Is there a PHP / Jquery/ javascript or any easy solution to get this done?
prsnAsked:
Who is Participating?
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.

Ray PaseurCommented:
Yes.  You might consider using a timer to refresh the client's data from the server-side data source.  JavaScript setInterval() function can be helpful.  This article shows the general design.
http://www.experts-exchange.com/articles/14519/A-jQuery-Progress-Bar.html
Ray PaseurCommented:
Having said that, please be aware that data coming from the server to a mobile device has a battery cost that is about 10x the same data coming from storage in the mobile device.  Sorry, I have no citation for this, but I believe it to be true.  So for the sake of your users you might consider telling them the last time the data was updated, or whether it is still being updated.  You might give them the option to turn on automatic polling or to work manually, and just use what they got most recently.
Slick812Commented:
greetings prsn, , you ask about needing to "refresh the browser" to get the latest TEXT file update, by doing what you call "clicks on the link" . . I am not sure about what may be a reason for this, OR what could be done to fix it, since the cause of it, is not clear to me? ? ?
If you could tell us more about what is on the web page that is suppose to load the text file, is it just a link <a>  like -
    <a href="info.txt">See the Information</a>

or does "the click"  involve some jquery javascript ?

I think that if you overwrite a file with PHP as you say "refreshed every 20 sec", then the time stamp for that file is also changed, which may or may not be useful for this?
But it's difficult 4 me 2 say what might be the problem, the browser catch maybe?
F PCommented:
I love intercooler.js for ease of install and use. See a polling example here. It's AJAX all via HTML attributes.

<div ic-prepend-from="/poll" ic-poll="1s" ic-target="#content">
    <div ic-target="this">
      <div class="btn btn-default active" ic-post-to="/play"><i class="fa fa-play"></i></div>
      <div class="btn btn-default" ic-post-to="/pause"><i class="fa fa-pause"></i></div>
    </div>
    <div id="content" ic-limit-children="5">
    </div>
  </div>

Open in new window


http://intercoolerjs.org/
... had it working in 5 minutes in production on multiple projects

is all you'd do frontend, then read the TXT file with a pointer in the PHP.

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
prsnAuthor Commented:
Hello Everyone

Thanks for the reply and recommendations. I will try your options to see which one one suit our needs.
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
PHP

From novice to tech pro — start learning today.