WordPress Ajax problem with undefined url

Here’s how localization works. The first thing you need to do is register your script with WordPress. This pretty much tells WordPress where the script is located, what version it is, any dependants ( like jquery ), and whether it will be located in the header or footer. More importantly you need to give it a unique identifier which you’ll be able to reference in the wp_localize_script() so WordPress knows your local variable scope. So throughout all 3 function calls, the unique identifier needs to be the same:

function add_exitpopup(){ 
    wp_enqueue_style('styleexitpop', get_bloginfo('template_directory') . "/exitpop/styleexitpop.css" );

    // Register Our Script:
    wp_register_script(
        'popup-js',
        get_bloginfo('template_directory') . "/exitpop/popup.js",
        array( 'jquery' )
    );

    // Localize Our Script with our AJAX URL ( Note the same unique identified at the front )
    wp_localize_script(
        'popup-js',
        'ajax_object',
        array( 'ajax_url' => admin_url( 'admin-ajax.php' ) )
    ); 

    // Enqueue Our Script
    wp_enqueue_script( 'popup-js' );
}
add_action( 'wp_enqueue_scripts', 'add_exitpopup' );