1
$.post(url, data, function(resp) {
    if (resp.error) {
        ...
    }
    else {
        $(".ui-dialog-titlebar-close").trigger('click');
    }
},"json");
}

我需要在 else 循环中关闭对话框,但是:

$('#customAssignmentDialog').dialog('close');

不关闭对话框,所以我尝试了:

$(".ui-dialog-titlebar-close").trigger('click');

但它进入了一个无限循环。有任何想法吗?强调文本

4

2 回答 2

0

知道了...

$('.ui-dialog-titlebar-close:visible').click()
于 2013-04-29T07:48:09.830 回答
0

这是一个工作示例,希望对您有所帮助:

<div id="dialog-message" title="Close Example">
    <span class="dialog-descr">
        Click Create to close the widget.
    </span>           
</div>  

<script>
    $(document).ready(function(){

        var closeWidget = function(){
            $("#dialog-message").dialog('close');
        }

        $("#dialog-message").dialog({
            autoOpen: false,
            modal: true,
            draggable: false,
            resizable: false,
            position: {my: "center top", at: "center top"},
            show: 'blind',
            hide: 'blind',
            width: 400,
            dialogClass: 'ui-dialog-osx',
            buttons: {
                "Create": closeWidget,
                "Annulla": function() {
                    $(this).dialog("close");
                }
            }
        });         

    });
</script>
于 2016-05-18T11:20:57.010 回答