Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

106
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda