karthika pommudu

karthika pommudu

  • NA
  • 321
  • 34.4k

Refresh Only the Link not a page or map,Can any one?

Jan 9 2019 4:21 AM
 Before this script I pass one link to get the latitude and longitude to track ,I need to refresh the link every 10seconds and code load automatic but not the page & map...
 
<script type="text/javascript">
setInterval(function() {
window.location.reload();
}, 10000);
var src_city1 = document.getElementById("src_city1").value;
var src_city2 = document.getElementById("src_city").value;
var src_city3 = document.getElementById("src_city2").value;
var src_city5 = document.getElementById("src_city5").value;
var map, marker;
var startPos = [src_city1,src_city2];
var speed = 50; // km/h
var delay = 100;
function animateMarker(marker, coords, km_h)
{
var target = 0;
var km_h = km_h || 50;
coords.push([startPos[0], startPos[1]]);
var spherical;
var computeDistanceBetween;
function goToPoint()
{
var lat = marker.position.lat();
var lng = marker.position.lng();
var step = (km_h * 1000 * delay) / 3600000;
var dest = new google.maps.LatLng(
coords[target][0], coords[target][1]);
var distance = google.maps.geometry.spherical.computeDistanceBetween(dest, marker.position);
var numStep = distance / step;
var i = 0;
var deltaLat = (coords[target][0] - lat) / numStep;
var deltaLng = (coords[target][1] - lng) / numStep;
function moveMarker()
{
lat += deltaLat;
lng += deltaLng;
i += step;
if (i < distance)
{
marker.setPosition(new google.maps.LatLng(lat, lng));
setTimeout(moveMarker, delay);
}
else
{ marker.setPosition(dest);
target++;
if (target == coords.length){ target = 0; }
setTimeout(goToPoint, delay);
}}
moveMarker();
}
goToPoint();
}
function initialize(){
var myOptions = {
zoom: 18,
center: new google.maps.LatLng(src_city1,src_city2),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var markers = [
{
"title": '',"description":'',"description1":'Active',"description2":'Active',"icons": "Markers/direction_icon.png","icon": "Markers/letter_m.png"
}];
map = new google.maps.Map(document.getElementById("dvMap"), myOptions);
var icon = "Markers/letter_m.png";
var infoWindow = new google.maps.InfoWindow();
var data = markers;
var data1 = data.description;
marker = new google.maps.Marker({
position: new google.maps.LatLng(startPos[0], startPos[1]),
map: map,
icon:icon,
// title: data.title,
// icon: data.icon,
//icons: data.icons
});
google.maps.event.addListenerOnce(map, 'idle', function(){
setInterval(marker, [
[src_city1, src_city2]
], 1000);
});
}
initialize();
</script>

Answers (1)