$.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');
但它进入无限循环。任何想法?强调文字
答案 0 :(得分:0)
得到了......
$('.ui-dialog-titlebar-close:visible').click()
答案 1 :(得分: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>