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: -
-
What is the address of the WordPress.com site you are having trouble with?
This is the support forum for sites hosted on WordPress.com. If you are referring to a self-hosted WordPress.org install, then you will have to seek help at the correct support forum, which is http://wordpress.org/support/
More about the difference between COM and ORG here: http://support.wordpress.com/com-vs-org/
- The topic ‘adding a ajax hook not working in shortcode?’ is closed to new replies.