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 AppUser;
use AppModelProposals;
use AppModelFavoriteUser;
//$Customers = User::find($orders->order_name_customer)->customers_name;
use CarbonCarbon;
$fav=FavoriteUser::get();
$pro=Locations::take('100')->orderBy('created_at','DESC')->get();
?>
</head>
<body>
<script type="text/javascript">
window.onload = setupRefresh;
function setupRefresh() {
setTimeout("refreshPage();", 15000); // milliseconds
}
function refreshPage() {
window.location = location.href;
}
</script>
<script>
var locations = [
@foreach($pro as $s)
@php ($p = $pro->where('user_id', $s->user_id)->first())
@php ($time1 = Carbon::now())
@php( $time2 = Carbon::parse($p->created_at))
@php ($diff = $time1->diffInMinutes($time2))
@if( $diff<=1)
['{{ AppUser::find($p->user_id)->customers_name}}', {{ $p->long}},{{$p->lat}}],
@endif
@endforeach
];