<script type="text/javascript" src="http://www.schimsky.com/jquery/jquery-3.4.1.min.js"></script>

<script type="text/javascript" src="http://www.schimsky.com/jquery/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>

<link type="text/css" rel="Stylesheet" href="http://www.schimsky.com/jquery/jquery-ui-1.12.1.custom/jquery-ui.min.css"/>

 

Use the code below to create a jquery dialog box without a DIV on the page.  The dialog attaches the ‘AutomaticallyClose()’ function to the open: event, which closes the dialog after n milliseconds and the close: parameter runs the CloseFunction()

 

<script language=javascript>

 

    $('head').append('<style>.ui-widget-overlay.ui-front {opacity:0.5; }</style>');

 

    $(function() {

        $('<div style="background-color:LightBlue"><p><img src="Saving.gif"></p></div>').dialog({

 

            open: function(event, ui) { $('.ui-dialog-titlebar').show(); AutomaticallyClose() },

            autoOpen: true,

            modal: true,

            close: CloseFunction,

            position: { my: 'center', at: 'center', of: window },

            closeOnEscape: false,

            draggable: false,

            resizable: false,

            width: 430,

            height: 400,

            title: 'Uploading Audio, Please Wait...',

            show: { effect: 'slide', duration: 2000 },

            hide: { effect: 'blind', duration: 2000 }

 

        }).prev().find('.ui-dialog-titlebar-close').hide();

 

    });

 

 

 

    function AutomaticallyClose() {

        setTimeout(function() {

 

            $(".ui-dialog-content").dialog("close");

        }, 5500);

    }

 

 

    function CloseFunction() {

        alert('yo closed');

    }

 

</script>