<script>

    let map, marker;


    function initMap() {
        var opt = {
            center: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
            zoom: 15,
            streetViewControl: true,
            mapTypeControl: false
        };

        map = new google.maps.Map(document.getElementById("map"), opt);
        var markerOpts = {
            title: $(document.getElementById("title")).val(),
            position: opt.center,
            draggable: true,
            map: map
        };

        displayPlace();

        google.maps.event.addListener(marker, 'dragend', function(evt) {
            $("#latitude").val(evt.latLng.lat());
            $("#longitude").val(evt.latLng.lng());
        });
    }

    function displayPlace() {
        marker = new google.maps.Marker({
            position: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
            map: map,
            draggable: true,
            title: $(document.getElementById("title")).val()
        });
    }


</script>