Ajax call returning 0 in page template

3 major problems: extract, is dangerous and introduces major security issues. It’s also completely unnecessary return instead of wp_die, you’re meant to echo the output and then exit/die. If you do not then WP will continue to handle the AJAX request, assume no handler was found, and print 0 JSON data type, the old legacy … Read more

Passing value from select form with Ajax not working

You seem to be missing the ajax actions, there are two, one for logged in users and one for not logged in users. Going by your action you will need to add the following actions. // this one for logged in users add_action(‘wp_ajax_my_action’, ‘my_action’); // this one for not logged in users add_action(‘wp_ajax_nopriv_my_action’, ‘my_action’);