0
I’m trying to get a certain time post
update every 1 minute.
Code:
setTimeout(function() {
var ID = $(this).attr('id').split('hora')[1]; // pega o ID e retira a parte "like"
$.get('index.php?hora=1&id='+ID, function(resultado){
$('#hora'+ID).html(resultado);
});
}, 2000 );
Error
index.php
:502 Uncaught Typeerror: Cannot read Propertysplit
of Undefined(...)
how is the attr id coming?
– Vinicius Maia
<div class="hour" id="hour<? php echo $Row['idd']; ? >"> <? php $old date = $Row['datap']; echo time_elapsed(date($old date)); ? ></div>
– Vinicius Henzel
Move
$(this)
for$('.hora')
, does it work? I suspect that$(this)
is not referencing the correct object.– Ricardo Moraleida
Now there was no mistake, masss did not work :\
– Vinicius Henzel
Help me @Ricardomoraleida
– Vinicius Henzel
"did not work" is not a good error description @Viniciushenzel, remember that we only know about your problem what you wrote in the question. If you include more information, it makes it easier to help. Including an example of attr ID as it appears in the browser (i.e., after processing PHP) also helps.
– Ricardo Moraleida
sorry the way I spoke Ricardo, well now I realized posting two messages, one updated, the other not... strange... I’ll show you how it is, after processed: <div class="hora" id="hora196"> 3 minute ago</div>
– Vinicius Henzel
People that strange, I realized that in the "source code" ta updated the time, but visibly not, ta stopped... Strange!!!
– Vinicius Henzel
@Ricardomoraleida by the source code updates, and visible not
– Vinicius Henzel