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 admin-ajax.php wasn’t built to use that data type, and requires complicated work arounds for it

Consider using a newer modern REST API handler instead. It will give you human readable messages, works closer to what you expected, has a pretty URL e.g. /wp-json/raja/v1/callbackcity, and supports JSON data type requests.