Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

111
Visualizações
Show real-time location

I have a web page that get locations of mobile phone.

Every time I want to see the change of the location I should make a page reload.


I want to have a refresh for the marker itself not all the page in a simple way


<?php
use App\User;
use App\Model\Proposals; // UNUSED IN THIS ISSUE SAMPLE
use App\Model\FavoriteUser;
use Carbon\Carbon;

$fav = FavoriteUser::get();
$pro = Locations::take('100')->orderBy('created_at', 'DESC')->get();
?>
<script>
    window.onload = setupRefresh;
    function setupRefresh() {
        setTimeout("refreshPage();", 15000);
    }
    function refreshPage() {
        window.location = location.href;
    }
</script>
<script>
    var locations = [
        <?php
        foreach ($pro as $s) {
            $p = $pro->where('user_id', $s->user_id)->first();
            $time1 = Carbon::now();
            $time2 = Carbon::parse($p->created_at);
            $diff = $time1->diffInMinutes($time2);

            if ($diff <= 1) {
                echo "[" . User::find($p->user_id)->customers_name . "," . $p->long . "," . $p->lat . "],";
            }
        }
        ?>
    ];
</script>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda