0

I'm trying to load the objective HTML Google Maps extension with Ajax. But i don't get it to work. Before i loaded the map without ajax and that works perfect.

This is the code i use:

In the Template:
$('.ajax-map').load('/site/ajax_google');

<div class="ajax-map"></div>

ajax google maps file
{exp:gmap:init
<!--General-->
    id="map" 
    class="ajax-map" 
    language="nl"
    scrollwheel="false"
    script_tag="false"

    etc...

The page does find the google maps file but doesn't load the map. Anybody a idea?

  • In what way doesn't it work? Are you just seeing grey tiles where the map should be? – foamcow Sep 4 '14 at 11:35
  • When adding script_tag="false" the map doesn't load at all everything stays blank. Without script_tag="false" it loads on the site/ajax_google but not with the jQuery load method. – Eddyfever Sep 8 '14 at 8:00
1

If a Google map is being "revealed" with Javascript then it is necessary to trigger the map resize event when it is displayed.

If you're using Google Maps for ExpressionEngine then there is GmapHelper which you can grab and call at the appropriate time to fire the resize event.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.