0

I have a dashboard set up to automatically refresh the page and data. I want to move away from that and only refresh divs. The only issue is that the data i am calling is from the back end and not a separate file. I have the following code:

 <script> var auto_refresh =setInterval(function({$('#test_refresh').fadeOut('slow').fadeIn("slow");}, 10000);

 <a href="#">Year to Date Sales<span id="test_refresh"> $<?=$this->YTDsales?></span></a>

Obviously the data is not refreshing, it's more or less of an effect. Is there a way to just refresh single php data? Thanks for any help.

Jcdevelopment
  • 51
  • 2
  • 8
  • [Answer #1](http://stackoverflow.com/questions/5384708/reload-a-div-with-jquery-timer/5384761#5384761) solved my problem. Works like a charm. – MrCleanX Feb 24 '14 at 19:45

1 Answers1

0

I wouldn't recomend to do a refresh via javascript, I would rather go through a simpler and cleaner solution try to do a polling or use websockets and update/get the information almost in real time.

look at this answer and you may get a clearer concept of what I'm suggesting and this is a practical example of a long polling in php

I hope that helps, cheers!

Community
  • 1
  • 1
pedrommuller
  • 15,741
  • 10
  • 76
  • 126