0
I have a page where I need to update some divs
with information coming from the bank. With this I am doing this way:
<div id='diva'>conteúdo a</div>
<div id='divb'>conteúdo b</div>
<div id='divc'>conteúdo c</div>
And so on. In jQuery:
setInterval(function() {
$("#diva").load(location.href+" #diva");
$("#divb").load(location.href+" #divb");
$("#divc").load(location.href+" #divc");
}, 1000);
Only I realized that by staying a few minutes on the same page, the page flashes and then the data disappears, coming right back. Would have some way of minimizing that impact?
The data appears and then they disappear and appear again, or they are only shown later?
– Rafael Almeida
appear and vanish... then appear,.... then the page stops blinking and flashes again....
– user24136
At the end of the
setInterval
(inside it yet), addconsole.log("Load")
. See how often the message appears on the console when the page loads.– Rafael Almeida
I put before or after the 1000?
– user24136
Before, "(inside it still)".
– Rafael Almeida
I put it this way: console.log("Load") }, 1000);
– user24136
appears every 1 sec..
– user24136
I believe if I change it to 10 seconds, it’ll lessen that impact, right? about the structure of jquery, it is correct to put several Divs the way it was placed?
– user24136
And do you need to change/load all these Ivs every second? (1000 ms)
– Sergio
It’s... a fault of mine... but I corrected and put 15 seconds... the initial idea was for each message that appeared, automatically updated. 15 seconds I believe it’s good, but if I’m wrong, I’m happy to be corrected :)
– user24136