WordPress.org

Support

Support » Plugins and Hacks » adding a ajax hook not working in shortcode?

adding a ajax hook not working in shortcode?

  • here is how it set up:
    add_shortcode(‘abc_abc’,’shortfun’);

    function shortfun()
    {
    include ‘ajax_res.php’;
    }

    —————————-in ajax_res.php:——————————————–
    add_action(‘wp_ajax_ex_abc’,’ex_abc’);
    function ex_abc()
    {
    echo ‘here!’;
    die();
    }

    ——————————-js call——————————-
    jQuery.ajax({
    type : “post”,
    url : myAjax.ajaxurl,
    data : {action: “ex_abc”},
    success: function(response) {
    alert(response);
    }
    }

    why is the output always 0. and it looks like the function hooked onto the ajax call “ex_abc” is never called.
    Blog url:

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘adding a ajax hook not working in shortcode?’ is closed to new replies.
Skip to toolbar