Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle maps won't load in window
    primarykey
    data
    text
    <p>On my website i want to open a div in jQuery and show the route to a certain address with Google maps.</p> <p>The problem is that for some reason my map won't load. If i go to the page directly it works, but if i open the page via jQuery i get an empty page. This is my code:</p> <pre><code> $("#showRoute").click(function(e){ e.preventDefault(); $("#shadow").add($("#shadowContent"),$("#closeBox")).remove(); $("body").append('').append(''); $("#shadowContent").append('Sluit venster').append(''); $("#closeBox").click(function(c) { c.preventDefault(); $("#shadow").add($("#shadowContent"),$("#closeBox")).fadeOut(500); }); $("#shadow").add($("#shadowContent")).fadeIn(500); $("#shadowContent").show().css({'width':'750px','top':'25px','left':'50%','margin-left':'-400px'}); $("#content").load('route.php?from='+$("#routeFrom").val()); }); </code></pre> <p><strong>route.php</strong></p> <pre><code> [.. HTML tags which also load google maps javascript file.. ] function initialize() { var latlng = new google.maps.LatLng(51.92475, 4.38206); var myOptions = {zoom: 10, center: latlng,mapTypeId:google.maps.MapTypeId.ROADMAP}; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var marker = new google.maps.Marker({position: latlng, map:map, title:"Cherrytrees"}); marker.setMap(map); } jQuery(document).ready(function () { initialize(); }); [..] &lt;div id="map_canvas" style="width:600px;height:400px;"&gt;&lt;/div&gt; [..] </code></pre> <p>Is there some security reason or something like that that the maps won't load?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload