I use ajax with jquery and when I tried to display the result in popup. Then alert always displays 0
0
success : function(results) { alert(result
I was adding the "action" incorrectly. You have to prefix your action with wp_ajax_gd_.
wp_ajax_gd_
add_action('wp_ajax_gd_[ACTION NAME]', '[CALLBACK FUNCTION NAME]')
and in the JS jQuery post:
var data = { 'action': '[ACTION NAME]', };
I found Wordpress' documentation very unclear about this part.