地图刷新按钮单击Javascript



JS:

function initialize() {
  var latLng = new google.maps.LatLng({{location_latitude}}, {{location_longitude}});
  var map = new google.maps.Map(document.getElementById('mapCanvas'), {
    zoom: 8,
    center: latLng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  });

在加载页面时正在加载映射。

除此之外,我需要它在点击按钮时刷新地图,即"<button>Refresh Map</button>"

如何在单击Refresh Map按钮时刷新地图。

$('button').on('click',initialize);

最新更新