Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
You should add wp_die(); at the end of your php function. But you could also send the response with wp_send_json, wp_send_json_error or wp_send_json_success. These functions also terminate the function execution.