Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!