wp_localize_script, variable is not defined in jquery

wp_localize_script should be called AFTER wp_enqueue_script:

IMPORTANT!: wp_localize_script() MUST be called after the script it’s
being attached to has been enqueued or registered. It doesn’t put the
localized script in a queue for later scripts.

Fix it in your function:

function my_action_callback() {
wp_enqueue_script('jscustom'); // I assume you registered it somewhere else
wp_localize_script('jscustom', 'ajax_custom', array(
   'ajaxurl' => admin_url('admin-ajax.php')
));

}

You can always check in your page’s <head> if you see your variable.