-2
Follow a part of the html code, I need to update this div (#line1) every x seconds without using php. It can be with jquery, ajax, js or all together. I don’t want to just change a div ("altered div"), it’s dynamic, it takes data from a controller. I want to give a refresh to reload the data, in case you had any Insert, delete or update in the database.
<div id="linha1" class="col-md-12">
<div class="col-md-3">
<h2>Dados Veículo</h2>
<table id="tabela">
<tr>
<td>Serial</td>
<td><h:outputText value="#{realtime.serial}" />
</td>
</tr>
<tr>
<td>Data</td>
<td><h:outputText value="#{realtime.data}" /></td>
</tr>
<tr>
<td>Hora</td>
<td><h:outputText value="#{realtime.hora}" /> </td>
</tr>
<tr>
<td>Eixos</td>
<td><h:outputText value="#{realtime.axlNumber}" /> </td>
</tr>
<tr>
<td>PBT</td>
<td><h:outputText value="#{realtime.pbt}" /> </td>
</tr>
<tr>
<td>Classe</td>
<td><h:outputText value="#{realtime.classe}" /> </td>
</tr>
<tr>
<td>Placa</td>
<td><h:outputText value="#{realtime.placa}" /> </td>
</tr>
<tr>
<td>Speed</td>
<td><h:outputText value="#{realtime.speed}" /> </td>
</tr>
</table>
</div>
</div>
If you understand English, here is the answer: https://www.brightcherry.co.uk/scribbles/jquery-auto-refresh-divevery-x-seconds/
– White
have you thought about using setTimeout?
– Ricardo Pontual
This one in Portuguese, if you did a little research, it already had the resolution... https://answall.com/questions/178662/upr-div-automaticamente-autorefresh-sem-update-p%C3%A1gina-toda
– White
Yeah, I’ve followed that topic already, but it doesn’t carry the div only, it carries the whole page, I don’t know what I’m doing wrong
– Leandro Kojima
Possible duplicate of Update DIV Automatically (autorefresh) without updating whole page
– Augusto Vasques