如何将Ajax Success函数变量调用到其他函数中[重复]

How to call Ajax success function variable into Other function, please have a look over the code.

var global_data;

    $.ajax({
        type: "post",
        url: "login.php",
        success: function (result) {
            console.log(result);
            global_data =   result;
            tick(global_data);

        }
    });

function tick(global_data) {
        $.toast({

        text: '30 days club',
        icon: '',
        loader: false,        
        loaderBg: '#9EC600',  
        allowToastClose: true,
        showHideTransition: 'fade'
        })
    initMap();
    console.log ("Jerry"+global_data);
    setTimeout(tick, random(20, 24) * 1000);
}

Here is the code, please have a look and after making all the changes still getting undefined in the console for function tick(global_data).

</div>