How to put a google map on JQUERY Mobile?
When tried to run the code , The map doesn't show up, and it shows up this error "Google Maps API warning: NoApiKeys "
. What are the possible solution for this? This is the script that I have added:
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
These are the codes that I have put at the js file:
$(document).ready(function () { var myOptions = { zoom: 11, center: new google.maps.LatLng(1.363083, 103.909836), mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
var myLatlng = new google.maps.LatLng(1.443107 , 103.795681);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: "Map "
})
});
That error suggests that you haven't included an API key with your Google Maps api call. You need to go to https://developers.google.com/maps/, sign up for an API key, and include it in your call. Below is a really simple example using the JS api.
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY></script>
链接地址: http://www.djcxy.com/p/81516.html
上一篇: 谷歌地图initMap添加参数功能