Title: Map and Ajax
Last modified: August 21, 2016

---

# Map and Ajax

 *  [Fesch](https://wordpress.org/support/users/fesch/)
 * (@fesch)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/map-and-ajax/)
 * Hello,
 * first of all thank you for the great plugin.
 * I try to use your plugin on a site, which loads posts via ajax. But the map is
   not showing.
 * Here is what i did so far:
 * I entered the short code in the post, but it returns empty.
 * I also tried to execute the short code in my template by:
    <?php echo do_shortcode(‘[
   google_maps id=”884″]’); ?> No success.
 * Also the scripttag, which is inserted by the plugin is empty.
    <script type=”
   text/javascript”>/* <![CDATA[ */var gmb_data = [];/* ]]> */</script>
 * I tried the shortcode on another site, which isn’t loaded via ajax and it works.
 * Do I have to reinitiate the plugin after the Ajax call? Or what am I doing wrong?
 * Thank you
 * [https://wordpress.org/plugins/google-maps-builder/](https://wordpress.org/plugins/google-maps-builder/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [Fesch](https://wordpress.org/support/users/fesch/)
 * (@fesch)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/map-and-ajax/#post-5040630)
 * Anyone?
 *  Plugin Author [Devin Walker](https://wordpress.org/support/users/dlocc/)
 * (@dlocc)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/map-and-ajax/#post-5040632)
 * Hey there sorry for the late reply. The plugin hasn’t been tested with an AJAX
   site implementation yet so I’m not sure what I can recommend that would help.
   I would need to see the site theme code and how it’s loading data and then determine
   the best way that Google Maps Builder can output the maps appropriately.
 *  Thread Starter [Fesch](https://wordpress.org/support/users/fesch/)
 * (@fesch)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/map-and-ajax/#post-5040633)
 * Thank you for your response.
 * This is a simplified version of the functions, which is called via Ajax.
 *     ```
       $post_id = $_POST['id'];
   
         global $post;
         $post = &get_post($post_id);
         setup_postdata( $post );
         echo include(locate_template('content-single.php'));
       ```
   
 * Inside the template file the content of the post is returned by
 * `<?php the_content(); ?>`
 * As I mentioned in my first post, I tried to execute the map shortcode inside 
   my template file after: the_content().
 * By `echo do_shortcode('[google_maps id="884"]');`
 * But it doesn’t work.
 * Thank you
 *  Thread Starter [Fesch](https://wordpress.org/support/users/fesch/)
 * (@fesch)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/map-and-ajax/#post-5040646)
 * Maybe you can give me just a little hint where to start? Is it possible to get
   the content of the map by the map id? Just like the_content() of a reuglar post?
 * I would really appreciate any help.
 * Thank you
 *  Plugin Author [Devin Walker](https://wordpress.org/support/users/dlocc/)
 * (@dlocc)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/map-and-ajax/#post-5040650)
 * Hmm, to be honest I’m not sure without getting hands on and debugging.
 *  Thread Starter [Fesch](https://wordpress.org/support/users/fesch/)
 * (@fesch)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/map-and-ajax/#post-5040651)
 * No problem. I solved the problem by using an iframe for the map. Not the best
   solution, but it works.
 * Just one last question:
    Is it possible to display a list of all locations next
   to the map?
 * Thanks

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Map and Ajax’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/google-maps-builder_f9f9f9.svg)
 * [Maps Builder - Google Maps Plugin](https://wordpress.org/plugins/google-maps-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-maps-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-maps-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/google-maps-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-maps-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-maps-builder/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [map](https://wordpress.org/support/topic-tag/map/)

 * 6 replies
 * 2 participants
 * Last reply from: [Fesch](https://wordpress.org/support/users/fesch/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/map-and-ajax/#post-5040651)
 * Status: not resolved