[Problem] Modal, Dialog whatever

Die Seite die geladen wird:
HTML:
<div id="dialog" title="Zeit erfassen">
    <form id="form" class="form-horizontal">
        <div class="form-group">
            <label for="worktype">Arbeitszeit-Typ:</label>
            <div class="input-group mb-3">
                <div class="input-group-prepend">
                    <span class="input-group-text">
                        <i class="fas fa-list-ol"></i>
                    </span>
                </div>
                <select class="form-control" name="worktype" id="worktype" aria-label="Arbeitszeit-Typ" required>
                    <option value="" selected>Arbeitszeit-Typ w&auml;hlen</option>
                    <option value="worktime">Produktivzeit</option>
                    <option value="forbuild">Fortbildung</option>
                    <option value="triptime">Reisezeit</option>
                    <option value="businesstrip">Dienstreise</option>
                    <option value="overtime">Abbau von &Uuml;berstunden</option>
                </select>
            </div>
        </div>
        
        <div class="form-group">
            <label for="layertype">Schicht-Typ:</label>
            <div class="input-group mb-3">
                <div class="input-group-prepend">
                    <span class="input-group-text">
                        <i class="fas fa-list-ol"></i>
                    </span>
                </div>
                <select class="form-control" name="layertype" id="layertype" aria-label="Schicht-Typ" required>
                    <option value="" selected>Schicht ausw&auml;hlen</option>
                    <option value="w1">Schicht von: 06:00 bis 14:12</option>
                    <option value="w3">Schicht von: 06:25 bis 14:37</option>
                    <option value="w2">Schicht von: 14:20 bis 22:32</option>
                    <option value="w4">Schicht von: 14:45 bis 22:57</option>
                    <option value="w5">keine regul&auml;re Schicht</option>
                </select>
            </div>
        </div>
        
        <div class="form-group">
            <label for="timefrom">Arbeitszeit von:</label>
            <div class="input-group mb-3">
                <div class="input-group-prepend">
                    <span class="input-group-text">
                        <i class="far fa-clock"></i>
                    </span>
                </div>
                <input type="time" class="form-control" aria-label="Arbeitszeit von" name="timefrom" id="timefrom" required />
            </div>
        </div>
        
        <div class="form-group">
            <label for="timeto">Arbeitszeit bis:</label>
            <div class="input-group mb-3">
                <div class="input-group-prepend">
                    <span class="input-group-text">
                        <i class="far fa-clock"></i>
                    </span>
                </div>
                <input type="time" class="form-control" aria-label="Arbeitszeit bis" name="timeto" id="timeto" required />
            </div>
        </div>
        
        <div class="form-group">
            <label for="datenow">Datum:</label>
            <div class="input-group mb-3">
                <div class="input-group-prepend">
                    <span class="input-group-text">
                        <i class="fas fa-calendar"></i>
                    </span>
                </div>
                <input type="date" class="form-control" aria-label="Datum" name="timeto" id="timeto" required />
            </div>
        </div>
        
        <div class="form-group">
            <button type="button" class="btn btn-sm btn-warning" id="reset">Reset</button>
            <button type="button" class="btn btn-sm btn-success" id="submit">Senden</button>
        </div>
    </form>
</div>

JS:
Javascript:
/**
 * Laden eines Dialoges
 * @param {string} name Page-Name
 * @param {integer} w Breite
 * @param {integer} h Höhe
 * @param {string} title Titlebar
 */
loadDialogs = function(name, w, h, title) {
    var url = './dialogs/' + name + '.php';
    $.post({
        url: url,
        data: { name: name },
        type: 'POST',
        success: function(data) {
            $(data).dialog({
                modal: true,
                draggable: true,
                resizable: false,
                position: {
                    my: 'center',
                    at: 'center',
                    of: window
                },
                width: w,
                height: h,
                title: title
            });
            $('#submit').click(function(e) {
                e.preventDefault();
                $('#form').serialize();
            });
        },
        error: function(data) {
            $.alert({
                title: 'Fehler',
                content: 'Blablabla'
            });
            console.log(data);
        }
    });
};

Aufruf der Seite:
HTML:
<a onClick="loadDialogs('timeAdd', 600, 600, 'Zeit erfassen')" role="button" class="nav-link"><i class="far fa-clock"></i> Zeit erfassen</a>
 
Zurück