title: Map Marker refresh/Update without refreshing whole map
body: <p>I cannot figure out how to edit this to make it so the map does not refresh but it continues to refresh the marker to get the updated positions.</p>
  
  <p>the positions are coming from
   this line</p>
  
  <pre><code>&lt;?php
  
  $json_pos = file_get_contents("C:\Users\KLAUS\Desktop\New\This SAMP\scriptfiles\positions.json");
       ?&gt;
  </code></pre>
  
  <p>right there</p>
  
  <pre><code>&lt;?php
  
  $json_pos = file_get_contents("C:\Users\KLAUS\Desktop\New\This SAMP\scriptfiles\positions.json");
       ?&gt;
  
  &lt;!DOCTYPE html&gt;
   &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="refresh" content="1" /&gt;
      &lt;title&gt;SA:MP live map&lt;/title&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt;
      &lt;script src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
      &lt;style type="text/css"&gt;
          #map-canvas { display: inline-block; height: 800px; width: 800px; }
          #map-legend { padding: 10px; background-color: rgba(141, 142, 127, 0.46);}
      &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div id="map-canvas"&gt;&lt;/div&gt;
  
      &lt;script src="js/SanMap.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          var p_pos = &lt;?php echo (empty($json_pos)) ? "" : $json_pos ?&gt;;
  
          var mapType = new SanMapType(0, 1, function (zoom, x, y) {
              return x == -1 &amp;&amp; y == -1 
              ? "images/tiles/map.outer.png" 
              : "images/tiles/map." + zoom + "." + x + "." + y + ".png";//Where the tiles are located
          });
  
          var satType = new SanMapType(0, 3, function (zoom, x, y) {
              return x == -1 &amp;&amp; y == -1 
              ? null 
              : "images/tiles/sat." + zoom + "." + x + "." + y + ".png";//Where the tiles are located
          });
  
          var map = SanMap.createMap(document.getElementById('map-canvas'), 
              {'Map': mapType, 'Satellite': satType}, 2, SanMap.getLatLngFromPos(0,0), false, 'Satellite');
  
          map.controls[google.maps.ControlPosition.TOP_RIGHT].push(document.getElementById('map-legend'));
  
          if(p_pos !== "")
          {
              for (var i = 0; i &lt; Object.keys(p_pos).length; i++) 
              {
                  if(p_pos[i].online == 1) createMarker(i); 
              }
          }   
  
          google.maps.event.addListener(map, 'click', function(event) {
              var pos = SanMap.getPosFromLatLng(event.latLng);
              console.log(pos.x + "," + pos.y);
          }); 
  
          function createMarker(id)
          {
              var p_windows = new google.maps.InfoWindow({
                  content: "&lt;p&gt;"+p_pos[id].name+" &lt;b&gt;(ID: "+id+")&lt;/b&gt;&lt;br&gt;Ping: "+p_pos[id].ping+"&lt;/p&gt;"
              });
  
              var p_marker = new google.maps.Marker({
                  position: SanMap.getLatLngFromPos(p_pos[id].x, p_pos[id].y),
                  map: map,
                  icon: "images/marker.png"
              });
  
              google.maps.event.addListener(p_marker, 'click', function() {
                  p_windows.open(map,p_marker);
              });
          }
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>