
jQuery(document).ready(function($) {
    $( '#lcms_upgrade_database' ).click( function() {
		
        var data = {
            'action': 'lcms_upgrade_db_script'
        };
        $( '#lcms_upgrade_database_preloader' ).css("display", 'inline-block');
        $.post( LDCSAdminVars.ajax_url, data, function(response) {
            $('.lcms_upgrade_notification').html('').css('display', 'none');
            $('#wpbody-content .wrap').prepend('<div class="notice notice-warning delete-log-entries"><p><img src="' + LDCSAdminVars.preloader + '" /> &nbsp;&nbsp;LearnDash Course Planner Pro is upgrading database as background process, you can continue exploring website.</p></div>');
            setTimeout(function () {
                $('#wpbody-content .wrap .delete-log-entries').slideUp();
            }, (1000 * 60) * 5); // 5 minutes settimeout
    
            setTimeout( function() {
                $( '.lcms_upgrade_notification' ).html('').css('display','none');
            }, 10000 );
        } );

	});
});   