正如你所看到的,在触发ajax post之前我有yes/no确认对话框。ajax成功后关闭jquery确认对话框
成功后,确认对话框仍然可见。
我失踪了什么?
function AbandonOrder() {
$('<div></div>').appendTo('body')
.html('<div><strong>Abandon order? <br/> You will be unable to edit this order in the future.</strong></div>')
.dialog({
modal: true, title: 'Abandon order', zIndex: 10000, autoOpen: true,
width: 400, resizable: false,
buttons: {
Yes: function() {
jQuery.ajax({
url: 'some_URL',
type: "POST",
dataType: "JSON",
success: function (data) {
if (data == 'OKAY') {
tosomething();
$('#dlgCard').dialog("close");
}
else {
$("#divMsg").html("<ul><li>This order cannot be edited.</li></ul>")
$('#dlgMsg').dialog('open');
}
//$(this).dialog("close");
$(this).remove();
}
});
},
No: function() { $(this).dialog("close"); }
},
close: function (event, ui) { $(this).remove(); }
});
$('.ui-button-text').css({ fontSize: 12 });
$('.ui-dialog-title').css({ fontSize: 12 });
}
我tryed与
$(this).dialog("close");
和
$(this).remove();
但确认仍然可见。
有你试图改变CSS能见度隐藏? – 2014-10-08 12:50:58
@MrCoder我想通过jquery关闭对话框。我没有尝试。 – dllhell 2014-10-08 12:52:47
[此网站](http://tutorialzine.com/2010/12/better-confirm-box-jquery-css3/)可能会使您受益。加上配置看起来也很干净! – 2014-10-08 12:55:40