Update DIV in Real Time

Asked

Viewed 2,779 times

-1

I would like to update only one div of a site, without updating the whole site and that this div was updated of 0.1 seconds every 0.1 seconds, and for example would not need to refresh or re-enter the site.

Basically I would like to make a change on my server, and not have to update the site to see this change, but wanted q this happens in only 1 div of my site.

How can I do that?

Thank you.

  • 2
  • It is not duplicate, in case it was with php, now I want with javascript/ajax

  • But it’s duplicated from the second I posted. That’s even your question.

  • Gonçalo does not duplicate questions unnecessarily, it is not the first time you do this, creating duplicates only harms the community in various factors, outside that there are other ways to make your question more evident, read this: http://meta.pt.stackoverflow.com/q/3966/3635 - Understand as a constructive criticism ;)

1 answer

-1

   <script>
   var nomedafuncao = function () {
  $('#iddadiv').load('paginaquequercarregar.php?_=' + new Date().getTime());
  };
   setInterval(nomedafuncao, 1000); // <- 1000 tempo em milisegundos = 1 segundo
   </script>

another option is to use long pooling

  • Not working div not updating.

  • it would be good to post your code to analyze better, you are linking jquery?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.