Support » Plugin: Maps Builder - Google Maps Plugin » Do shortcode ajax call

  • Resolved juanpa13


    I’m trying to call the shortcode from an ajax request but some libraries appears to not loading , when i use the shortcode in the index.php works fine but when i use the ajax call the shortcode executes but the maps doesn’t show only the containers

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Matt Cromwell


    I believe you’ll need to additional trigger the Google Maps Javascript after the AJAX call. This is an example of how you can trigger it again:

    Let me know how that goes.

    Thread Starter juanpa13


    How should i implement this code, i’m not sure how to do it

    actually i have 3 parts of my code

    <button class=”ver-mapa flex-it flex-align-item-center” data-shortcode=”42″><i class=”icon-location”></i>Ver en mapa</button>

    add_action( ‘wp_ajax_show_map’, ‘show_map’);
    add_action( ‘wp_ajax_nopriv_show_map’, ‘show_map’);

    function show_map() {
    $short = ‘[google_maps id=”‘.$_REQUEST[‘shortcode’].'”]’;
    echo do_shortcode($short);

    var ajaxUrl = ‘<?php echo admin_url(‘admin-ajax.php’); ?>’;
    var data = {
    action: ‘show_map’,
    shortcode: $(this).attr(‘data-shortcode’)
    $.post(ajaxUrl,data).done(function(response) {

    Plugin Author Matt Cromwell


    It’s hard to say exactly, but the root of the problem is that our localized data isn’t being loaded because of your AJAX call. The plugin really isn’t built to be rendered that way. I’d recommend having the map on the page at load time and redrawing it when the lightbox initializes.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Do shortcode ajax call’ is closed to new replies.