Google map无法使用javascript进行第二次加载

Google map无法使用javascript进行第二次加载,javascript,jquery,ajax,google-maps,google-maps-api-3,Javascript,Jquery,Ajax,Google Maps,Google Maps Api 3,我已经看到了一些关于类似问题的问题,但是没有一个解决了我的问题,所以我继续 Google maps有以下问题:我试图加载一个模式对话框,其中Google map使用javascript调用该对话框: <html> <body> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> &l

我已经看到了一些关于类似问题的问题,但是没有一个解决了我的问题,所以我继续

Google maps有以下问题:我试图加载一个模式对话框,其中Google map使用javascript调用该对话框:

<html>
    <body>
        <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>

        <a onclick="locationDetail(76)" id="76" data-toggle="modal" data-target="#myModalLocationDetails">Edit</a>

        <div id="myModalLocationDetails" class="modal modal modal-metro border-mauve fade in" aria-hidden="false" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" style="display: none;">
            <div class="modal-header">
            </div>
            <div class="modal-body">
                <div id="locationEdit" class="col-md-12">
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </body>
</html>
加载到#locationEdit(locationEdit.html)中的代码是:

此事件调用的文档位于

您知道不使用引导而使用其他jquery事件的其他方法吗? 谢谢

尝试在.load()之前清理#locationEdit div--类似

function locationDetail(locId) {
    $("#locationEdit").html(''); // or $("#locationEdit").empty();
    $("#locationEdit").load('/Home/LocationEdit/' + locId, function () {
            initialize(44.7862, 20.45345);
        }
    );
}

google.maps.event.trigger(映射,'resize')因为
initialize()
中的最后一行不起作用?@davidkonrad,它不起作用
<html>
<head></head>
<body>
<script type="text/javascript">

function initialize(latitude, longitude) {

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

    var map = new google.maps.Map(document.getElementById('map-canvas'), {
        zoom: 12,
        center: myLatlng,
        //mapTypeId: google.maps.MapTypeId.ROADMAP,
        zoomControl: true,
        panControl: true
    });

    var marker = new google.maps.Marker({
        position: myLatlng,
        map: map
    });
}

</script>

<div id="map-canvas">
</div>
<button type="button" class="btn btn-primary" onclick="initialize(44.7862, 20.45345)">Update</button>
</body>
</html>
$(function() {
    $('#myModalLocationDetails').on('shown.bs.modal', function () {
        initialize(44.7862, 20.45345);
    });
});
function locationDetail(locId) {
    $("#locationEdit").html(''); // or $("#locationEdit").empty();
    $("#locationEdit").load('/Home/LocationEdit/' + locId, function () {
            initialize(44.7862, 20.45345);
        }
    );
}