vendredi 25 décembre 2015

how to show google map marker dynamically in a laravel view page

i found some java script code on the internet. Its helping me to store the latitude and longitude of a place, from the google map by moving the marker on my database table. database column names are la|lo. now i want to show the location on a view page. the map should have these properties frameborder="0" scrolling="no" marginheight="0" marginwidth="0"width="250" height="272" Can anyone help me on this ? because im novice and i have poor knowledge on javascript.im providing the js code of registering the latitude and longitude.

<script
src="http://ift.tt/1aRtlzY">
</script>
<script>
function initialize() {
    var latitude = 23.786758526804636;
    var longitude = 90.39979934692383;
    var zoom = 11;

    var LatLng = new google.maps.LatLng(latitude, longitude);

  var mapProp = {
    center: LatLng,
    zoom:12,
    mapTypeId:google.maps.MapTypeId.ROADMAP
  };
  var map=new google.maps.Map(document.getElementById("googleMap"), mapProp);
  var marker = new google.maps.Marker({
      position: LatLng,
      map: map,
      title: 'Drag Me!',
      draggable: true
    });
  google.maps.event.addListener(marker, 'dragend', function(event) {

      document.getElementById('la').value = event.latLng.lat();
      document.getElementById('lo').value = event.latLng.lng();



});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>

        <div id="googleMap" style="width:auto;height:400px;"></div>

        <input type="hidden" id="la" name="la">
        <input type="hidden" id="lo" name="lo">



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire