我创建了一个 jQuery 对话框。下面是我创建的 Ajax 函数。
$.ajax({
url: "/StaffManageCertifications/GetExamCodesAndCategory/",
type: "Post",
datatype: "html",
success: function (data) {
debugger;
$('#divExamCodesCategory').html(data);
$("#divExamCodesCategory").dialog({
autoOpen: false,
width: 700,
height: 610,
modal: true,
resizable: false,
draggable: true,
title: 'Add Exam Code/Category'
});
$("#divExamCodesCategory").dialog("open");
$('a.ui-dialog-titlebar-close').remove();
$('#divProcessImage').css({
"display": "none"
});
},
error: function (req, status, error) {
ErrorMessageStaff(req.responseText);
$('#screen').css({
"display": "block",
"width": "",
"height": ""
});
$('#divProcessImage').css({
"display": "none"
});
}
});
现在,我在 div = divExamCodesCategory 上放置了两个按钮(确定和取消)。
并写在下面的代码行中,每次关闭它时都会破坏这个对话框。
$("#divExamCodesCategory").dialog("destroy");
现在,当我第二次打开它时,第一次点击 - 它不显示对话框。第二次点击 - 它确实显示对话框但没有数据。空对话框。
此外,它不会出现在屏幕中央。它下降到屏幕底部。下面是此对话框的位置样式。
.ui-dialog {
padding: 0em !important;
position: fixed !important;
}
对此的任何帮助表示赞赏。
谢谢。