Some time ago I used the regular method of loading Google Maps API like this:
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=abcdefg&sensor=true">
Later I switched to Google AJAX APIs to load Google Maps API. This was because a couple of "widgets" on my website needed the Google Ajax API loader so I chose to be consistent and used the AJAX APIs to load Google Maps as well:
<script type="text/javascript" src="http://www.google.com/jsapi?key=abcdef"></script>
<script type="text/javascript">
google.load("maps", "2", {"other_params": "sensor=true"});
</script>
Now that I have finally decided to use Google Maps API v3, this page does not list API v3 in the available version list. None of the examples on API v3 documentation show the use of AJAX APIs as well. Is is possible (and supported) to load Google Maps API v3 via AJAX API loader?
Designed to compete with well-established mapping sites, Google Maps uses Ajax to avoid reloading its main page at all (see Figure 1-4). Unlike other mapping web applications, Google Maps enables you to drag the map to move it in various directions.
A web page or application displays a map using the Maps JavaScript API.
The Maps JavaScript API uses a pay-as-you-go pricing model. Maps JavaScript API requests generate calls to two different SKUs depending on the type of request: map loads or panoramas.
It's undocumented, but it works.
google.load("maps", "3", {other_params:'key=YOUR_API_KEY', callback: function(){
var map; // initialize your map in here
}});
[EDIT] The documentation now requires the use of an API key that is passed to the loader as a "key" parameter. I've removed 'sensor=false' as a parameter because it is now explicitly not required and throws a warning when provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With