javascript - Google Maps is loading endlessly in JQuery Mobile -


i using google maps in 1 of jquery mobile pages, , instead of loading whole maps javascript files on every page, i've included them page in google maps used.

but when navigate page, loading spinner spinning , spinning around nothing happens. when delete gmaps code works fine.

i use this plugin code looks that:

<div data-role="page" id="page1" data-theme="a">     <?php include "components/site_header.php"; ?>     <!-- scripts maps -->     <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>     <script src="library/jquery.ui.map.full.min.js" type="text/javascript"></script>     <!--.................-->     <div data-role="content">                <div id="map_canvas" style="width:100%;height:250px"></div>                     <script type="text/javascript">                     $(function() {                         var latlng = new google.maps.latlng(<?=$lat;?>, <?=$lon;?>);                         $('#map_canvas').gmap({'center': latlng});                     });                     </script>                </div>     </div> </div> 

edit code working when call webpage directly (over url). loading endlessly when navigate through website...

edit2 got code work. removed plugin stated above , added google maps js file before jquery , jquery mobile js. , code looks this:

            <div id="map_canvas" style="width:100%;height:250px"></div>                <script type="text/javascript">                 var address = '<?php echo $info['pr_city'].", ".$info['pr_zip'].", ".$info['pr_street'].", ".$info['pr_nr']; ?>';                 var map = new google.maps.map(document.getelementbyid('map_canvas'), {                     maptypeid: google.maps.maptypeid.roadmap,                    zoom: 15                });                 var geocoder = new google.maps.geocoder();                 geocoder.geocode({                   'address': address                },                 function(results, status) {                   if(status == google.maps.geocoderstatus.ok) {                      new google.maps.marker({                         position: results[0].geometry.location,                         map: map                      });                      map.setcenter(results[0].geometry.location);                   }                });                </script> 


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -