do_shortcode('[responsive_menu]') Not Working On Ajax Call

Home Forums Pro Support do_shortcode('[responsive_menu]') Not Working On Ajax Call

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #67964
    Anonymous

    $.post(‘<?php echo get_template_directory_uri().”/menu.php”?>’, {from_email: “test”, action: “menu_ajax_call”, nonce:ajax_var.nonce}, function (data) {
    console.log(data);
    });

    if (shortcode_exists(‘responsive_menu’)) {
    echo do_shortcode(‘[responsive_menu]’);
    }

    im load your menu on document ready post ajax call but not working

    #67967
    Peter FeatherstonePeter Featherstone
    Participant

    Hey Karthi,

    I’m not sure what you are trying to do here.

    What doesn’t work specifically? What errors are you getting? Where are you putting this?

    Have you tried it with a simpler shortcode to check that you can actually do something like this?

    Please advise

    Peter

    #67966
    Anonymous

    Hi

    I have used your plugin short code to display menu in header.php directly its working fine by below code
    <?php echo do_shortcode(‘[responsive_menu]’); ?>

    I have done by this below link
    https://responsive.menu/knowledgebase/using-the-shortcode/?utm_source=free-plugin&utm_medium=page&utm_campaign=using-the-shortcode&#8221;

    When I am trying to print this menu short code <?php echo do_shortcode(‘[responsive_menu]’); ?> by ajax its not working.

    Please refer the below code are not working,
    in Functions.php
    function func_resonsive_menu(){
    echo do_shortcode(‘[responsive_menu]’);
    die();
    }
    add_action(‘wp_ajax_resonsive_menu’,’func_resonsive_menu’);
    add_action(‘wp_ajax_nopriv_resonsive_menu’, ‘func_resonsive_menu’);

    Javascript:

    $.get(“<?php echo admin_url(‘admin-ajax.php’)).’?action=resonsive_menu’;?>”
    function (data) {console.log(data);
    });

    its just printing short code instead of menu while loading by ajax.
    Hope you understood if you have knowledge in wordpress ajax.

    Thanks,
    Karthi.

    #67965
    Peter FeatherstonePeter Featherstone
    Participant

    Hey Karthi,

    Unfortunately I don’t have any experience using WordPress AJAX.

    I wonder if anyone else here in the community has some experience doing this that can help you out.

    All the best

    Peter

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘do_shortcode('[responsive_menu]') Not Working On Ajax Call’ is closed to new replies.