javascript - Google map loads on localhost ,but fails to load on online server -
i have been able deploy google map on localhost, loads coordinates success. when upload same code server, fails load.i tried could, @ lost here.
<html> <head> <script type='text/javascript' src='jquery-1.6.2.min.js'></script> <script type='text/javascript' src='jquery-ui-1.8.14.custom.min.js'></script> <style> body {font-family : verdana,arial,helvetica,sans-serif; color: #000000; font-size : 13px ; } #map_canvas { width:100%; height: 100%; z-index: 0; } </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false" /></script> <script type='text/javascript'> jquery(document).ready( function($){ function closeinfos(){ if(infos.length > 0){ infos[0].set("marker",null); infos[0].close(); infos.length = 0; } } //get data, , replace on form var geocoder; var map; var markersarray = []; var infos = []; geocoder = new google.maps.geocoder(); var myoptions = { zoom: 9, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); function deletemarkers() { (var = 0; < markersarray.length; i++) { markersarray[i].setmap(null); } markersarray = []; } setinterval(function(){ $.get('ajax_gp_gps.php', function(data){ var bounds = new google.maps.latlngbounds(); var encodedstring; var stringarray = []; encodedstring = data; stringarray = encodedstring.split("****"); var x; (x = 0; x < stringarray.length; x = x + 1) { var addressdetails = []; var marker; addressdetails = stringarray[x].split("&&&"); var lat = new google.maps.latlng(addressdetails[1], addressdetails[2]); //alert(image + " " + addressdetails[1] ); marker = new google.maps.marker({ map: map, position: lat, content: addressdetails[0] }); markersarray.push(marker); google.maps.event.addlistener( marker, 'click', function () { closeinfos(); var info = new google.maps.infowindow({content: this.content}); // have added .html marker object. //infowindow.setcontent( marker.html); info.open(map,this); infos[0]=info; }); bounds.extend(lat); } map.fitbounds(bounds); }); },1000); }); </script> </head> <body> <?php include_once("ajax_gp_gps.php"); ?> <div id='input'> <input type="hidden" id="encodedstring" name="encodedstring" value="<?php echo $encodedstring; ?>"> </div> <div id="map_canvas"></div> </body> </html>
you need check google api if online domain has access call or not.
Comments
Post a Comment