SHARE
TWEET

Untitled

a guest Jun 16th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.     var map;
  3.     var area = {lat: 5.365722, lng: 100.3158698};
  4.     var marker, i;
  5.  
  6.     function initMap(locations) {
  7.         map = new google.maps.Map(document.getElementById('map'), {
  8.             zoom: 12,
  9.             center: penang
  10.         });
  11.  
  12.  
  13.  
  14.  
  15.     }
  16.  
  17.     getEvent();
  18.     function getEvent() {
  19.         $.ajax({  
  20.             type: "POST",
  21.             url: 'CallData.php',                          
  22.             data: "",                        
  23.             contentType: "application/json; charset=utf-8",
  24.             dataType: "json",              
  25.             success: function(data1){
  26.                 updateMap(data1);
  27.             },
  28.             complete: function (data1) {
  29.                 setTimeout(getEvent, 1000);
  30.                 console.log(data1);
  31.             }
  32.         });
  33.  
  34.  
  35.  
  36.  
  37.     }
  38.  
  39.  
  40.  
  41.     markersarray = [];
  42.  
  43.     function updateMap(locations) {
  44.     var infowindow = new google.maps.InfoWindow();
  45.     for (var i=0; i<locations.length; i++)
  46.     {
  47.  
  48.  
  49.     marker = new google.maps.Marker({
  50.         position: new google.maps.LatLng(locations[i][2], locations[i][3]),
  51.         map: map,
  52.         icon : locations[i][0]
  53.  
  54.         });
  55.  
  56.  
  57. markersarray.push(marker);
  58.         google.maps.event.addListener(marker, 'click', (function(marker, i) {
  59.         return function() {
  60.             infowindow.setContent(locations[i][1]);
  61.             infowindow.open(map, marker);
  62.         }
  63.         })(marker, i));
  64.  
  65.  
  66.     }
  67.  
  68.  
  69.   }
  70. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top