Jump to Content

Objective HTML

Google Maps for ExpressionEngine

The complete geolocation and mapping toolkit

Loading Google Maps with AJAX

It's possible to load your maps with AJAX. Be sure to include any dependent scripts (like Google Maps API, infobox.js, css, etc) in the template that sends the HTTPS request. The Google Maps API is loaded asynchronously, so you if you are already loading you the script asynchronously, the Google libraries never get loaded (as you could imagine). By including them in the template directly, you will ensure that script gets loaded with the DOM.

Main Template

	
	
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">



Ajax Template

The important thing to note here is to always have script_tag set to false.

	
{exp:gmap:init id="map" script_tag="false" address="indiana" style="width:400px;height:300px"}

{exp:channel:entries 
	channel="test_channel"
	limit="10"
}
	
	{map id="map"}

{/exp:channel:entries}