Ajax : Why success displays 0? Ajax : Why success displays 0? wordpress wordpress

Ajax : Why success displays 0?


Try to add die(); or exit(); at the very last line of the function.


May be you are trying without login. so you need to use this action.

add_action('wp_ajax_nopriv_my_action', 'my_action_callback');

you will get response. :)


I had a similar issue with admin-ajax.php returning 0, even i had die().

My problem was that the add_action was declared in a file not loaded default by plugin.

Anyway, if you have problem also check in browser what __.com/wp-admin/admin-ajax.php?action=youraction returns.